Joomla > RSForms

Put your Label in the input box

Joomla > RSForms

Often in Joomla, real estate on the screen can end up at a premium.

Putting forms in modules is not uncommon, but to further reduce space, putting the label for the field into the field itself can save valuable pixels.

 

Change a hidden field on a form based on dropdown value

Joomla > RSForms

As always, necessity can be the mother of invention. And as is becoming more often, I'm writing another blog post mainly so I can come back and find the answer next time I need it, as well as share it with anyone else that it might assist.

Today I needed to setup an RSForm!Pro form to do the following:

  • Select the subject type from a dropdown
  • Based on the subject type, set the email addresses to send the form result through to.

Change this:
to Change this:

 

Is that a real email address? From a real domain?

Joomla > RSForms

In RSForms the out of the box validation for email fields checks that the value being submitted is just a correctly formatted email address. However, ID-10-T errors can sometimes mean that though the address is valid with the default check, it's not actually a valid address due to:

  • dropping a dot in the email suffix is valid, but the domain may not be. eg @kpsystems.comau vs @kpsystems.com.au
  • prefix being the wrong length or containing invalid characters
  • suffix being the wrong length or containing invalid characters

So to fix it, what's needed is a better validation routine for email.

 

In need of validation...

Joomla > RSForms

KPS use RSForms Pro to create a variety of forms for clients. These have included to date contact forms, application forms, registration forms and forms for competition entries.

Customers often require extra validation on fields to ensure that what's being collected is correct.

The RSForms Documentation gives some details as how you can add custom validation rules to your RSForms installation.

In order to add a new validation rule, navigate in your Joomla file list, go to components/com_rsform/helpers/validation.php*. In this file you will find all the validation rules defined. In order to add a new validation rule, edit the file validation.php in the following manner:

  1. Add a new function that allows only one parameter. The name of the function will be the name of the validation rule, as displayed when adding a new component.
  2. On success, the function should return true. On fail, the function should return false.