Navigation
Records in this category
- Is it possible to communicate between different projects?
- Enabling the Language Translation functionality.
- Add a File Upload Control to a Form / Page
- How do I create a Dojo FilteringSelect control?
- How do I communicate between different WebMaker Projects?
- How to use extended border styling (rounded corners)
- How do I use the Editable Row control?
- How do I use the Paging Table control?
- How do I use the Tree control?
- How do I change the calendar/date picker control used on the created pages?
- How do I control the width or height of a Group, Grid or Repeat?
- How do I force a gap (space) between two Fields, Groups or within a Grid?
- How can I hide a field or group of fields conditionally based on a specific value of a data field?
- How can I change the look and feel of the background for mandatory fields?
- How to align columns in Repeating Tables to the left, right or centre.
- How to display an associated image instead of a Field's data value in a repeating table column.
- How to hide or suppress a value in a repeating table row if it is the same as the value in the row above.
- How to add a validation check for an email address format.
- How to highlight a row within a repeat table on hover.
- How to dynamically hide an entire column of a repeat table based on the value of another field.
- How do I customize the client side validation messages displayed on a page?
- How do I restrict a date value based on 'today' or another field?
- How do I invoke the validation routines from my custom JavaScript function?
- How do I add my own custom validation checks in addition to the built in functionality?
- Can I dynamically change the data constraints for a field?
- Use AJAX to dynamically populate a dropdown list
- Can I copy and paste HTML onto my WebMaker pages?
- How to use Google Fonts on a Page
- How to create a Rounded Box with CSS3 (including Corners and Shadows)
- How do I enable 'as you type' validation?
- How do I add a Dojo Number Spinner control?
- How do I add a Dojo Rich Text Editor control?
- How do I override or clone WebMaker CSS or javascript files?
- How do I always disable or show/hide groups or fields?
Tags
Examples » Specific Features
How do I enable 'as you type' validation?
FormMaker provides a number of options for controlling how fields are validated, and by default links this validation up to the submission actions available for buttons etc.
It is however possible to enable validation of each field as the user is entering their data. To do this, you would need to add an 'onload' event to your page, with the following custom script content.
dojo.query('input[type=text], textarea, select')
.onkeyup(function(e){hyf.validation.validateField(e.target);})
.onchange(function(e){hyf.validation.validateField(e.target);})
.onfocus(function(e){hyf.validation.validateField(e.target);});
You should now find that each field is validated as you enter or select the values.
If your page also makes use of dojo form widgets (such as a Filtering Select or Currency field) then you should add the following code to the onload event to make sure the validation of these also works in the same way.
var widgets = dijit.findWidgets(document);
for (var i=0; i < widgets.length; ++i)
{
dojo.connect(widgets[i], 'onKeyUp', function(e){hyf.validation.validateField(dijit.byId(e.target.getAttribute('id')));});
dojo.connect(widgets[i], 'onChange', function(e){hyf.validation.validateField(dijit.byId(e.target.getAttribute('id')));});
dojo.connect(widgets[i], 'onFocus', function(e){hyf.validation.validateField(dijit.byId(e.target.getAttribute('id')));});
}
If required, you can place this code into a function in an external script file, and just call this new function from the onload event definition on the Field Details tab.
Tags: Dojo, validation
Related entries:
- How does the Compare action indicate differences between XML fragments?
- How should MVC WebMaker be used with source control systems?
- How can I hide a field or group of fields conditionally based on a specific value of a data field?
- MVC_2.6.0001: Fix for problems that can occur after editing the view node.
- MVC_2.6.0016: Improve support for form validation from anchor buttons
Last update: 2010-07-12 18:17
Author: Hyfinity support team
Revision: 1.1
You can comment this FAQ