This page lists all of ABetterForm’s available classes. Classes define and control the behavior of ABetterForm’s validation and submission processes.
Below is an example of how classes are used.
The classes are located in the class attribute.
Or if you’re using the convert option:
convert: '{my-div|text|class="abrequired abtest" rel="@#%<>"}'
- absubmit
- Important! This is the default class used to define the form submission button object. The button can be any object provided it resides within the form and you assign it this class, OR use the submit_class option to define a different class name for this function.
Do not use a real submit button for this! Instead, use a push button, link, image, or something else besides a button of the submit type.
Correctconvert: '{myButton|button|class="absubmit"}'Incorrectconvert: '{myButton|submit|class="absubmit"}'Correcthtml: '<input id="myButton" type="button" class="absubmit" />
Incorrecthtml: '<input id="myButton" type="submit" class="absubmit" />
- aballnum
- Use this class on fields that require numbers and letters only.
convert : '{myId|text|class="abrequired aballnum"}'
- abcheckall
- Use this class on a checkbox and it will toggle all of the other checkboxes in the form.
convert : '{myId|checkbox|class="abcheckall"}'
- abcustom
- Assign this class a field if you want to check it against a custom regular expression filter. To use this, you must also use the html attribute rel to hold the regular expression. ABetterForm's built-in validation will check fields with this class using your custom regular expressions.
convert : '{myId|text|class="abcustom" rel="/^[a-z]([0-9a-z_])+$/i"}'
- abemail
- Assign this class to email fields if you want to use ABetterForm's built-in email address validation.
convert: '{myField|text|class="abrequired abemail"}'Orhtml: ''
- aberror
- ABetterForm's built-in validation will automatically add this class to fields that do not pass validation. Add this class to your css stylesheet to customize.
- aberror-helper
- ABetterForm's built-in validation will automatically add this class to the error message for fields that do not pass validation. Add this class to your css stylesheet to customize.
- ablength
- Assign this class to fields which need a length range or a minimum length. To use this, you must also use the html attribute rel to hold the range. The range can be a single number representing the minimum required length, or it can be a comma separated value consisting of 2 numbers, which represent the lower and upper range limits.
Range: In this example, the text field has a required length between 3 and 6 characters. The example field is also a required field.convert : '{myId|text|class="abrequired ablength" rel="3,6"}'Minimum limit only: In this example, the text field has a required minimum length of 4 characters.convert : '{myId|text|class="ablength" rel="4"}'
- abletters
- Use this class on fields that require letters only.
convert : '{myId|text|class="abrequired abletters"}'
- abnospecial
- Use this class on fields that do not allow special characters.
convert : '{myId|text|class="abrequired abnospecial"}'
- abnumbers
- Use this class on fields that require numbers only.
convert : '{myId|text|class="abrequired abnumbers"}'
- abrequired
- Assign this class to required fields if you want to use A Better Form's built-in validation.
convert: '{myField|text|class="abrequired"}'Orhtml: ''
- abselectall
- Form fields with this class will automatically focus and select all text when a user clicks the field.
convert : '{myId|textarea|class="abselectall"}'
- absubmitted
- ABetterForm automatically assigns this class to form fields which were submitted.
- abtest
- Use this class to test fields for specified characters. Requires the rel attribute to hold a list of illegal characters. If the field contains any of the characters in the list, it will fail validation and form submission will be aborted.
convert : '{myId|text|class="abrequired abtest" rel="^$#@()"}'
- aburl
- Assign this class to URL address fields if you want to use ABetterForm's built-in URL address validation.
convert: '{myField|text|class="abrequired aburl"}'Orhtml: ''
- abusername
- Use this class on fields that require numbers, letters, and underscores only.
convert : '{myId|text|class="abrequired abusername"}'
- abvalidate
- This is the default class used in the validator_class option. Any object with this class, when clicked, will run ABetterForm's validation process without submitting the form. The form's submit button object does not need this class. This class is useful for multi-stage forms.
convert : '{myId|button|class="abvalidate"}'Orhtml: ''