Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.3.2

Request #5308 Javascript Validation with Ajax
Submitted: 2005-09-06 09:29 UTC
From: xolphin Assigned: avb
Status: Closed Package: HTML_QuickForm2
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: 0.6.0    

 [2005-09-06 09:29 UTC] xolphin
Description: ------------ At the moment HTML_QuickForm uses some Javascript validation if wanted on the OnSubmit of the form. This saves some time checking the form on the server, but it looks nasty. The user has to read the alert created by the JavaScript, and has to find the form element where the error is in. Ajax is a development methodology focused on removing click and wait in web applications. I won't explain it here, because there is already a lot of information available on it. I think Ajax can be used in HTML_QuickForm very good. With Ajax we could get the folowing advantages: - Validation code only has to be written ones, and is executed on the server (without the need to submit anything). We don't need a php validation seperate from a javascript validation anymore. - Code can be checked realtime, while the user is filling in the form. He can instantly see he has done something wrong. Of course this can be made with normal JavaScript too, but Ajax makes it some easier. - Auto completion can be done with realtime data, instead of auto completion with static data which is already possible now. A nice example of what can be done with Ajax can be found on . For better clarification the form elements with errors can be colored for example yellow or orange. But that is up to the developer. I hope this is the right place to make such a suggestion, if this is better of in another place, please let me know. I like the Ajax idea a lot and if needed I am willing to code it into HTML_QuickForm. Below some useful links with more info of Ajax. Validation with Ajax: Ajax information: How Ajax works: Ways to implement it: Pear implementation:


 [2006-06-08 13:24 UTC] avb (Alexey Borzov)
Moving feature requests to HTML_QuickForm2.
 [2011-03-27 11:22 UTC] doconnor (Daniel O'Connor)
An alternative which may be more practical is a renderer which is aware of HTML5. and For simple cases such as required fields, simple regexp patterns, title attributes, HTML5 can support this without the need for javascript. $form->addElement('text', 'name'); $form->addRule('name', '[a-zA-Z]'); print $form; // On rendering, a pattern attribute is added to the name field; or via the DOM.
 [2011-03-27 11:42 UTC] doconnor (Daniel O'Connor)
 [2011-04-21 16:42 UTC] avb (Alexey Borzov)
For now, added means to run validation onblur / onchange, like in DHTMLRulesTableless. Ajax can be plugged in, it will be easy enough if using the above-mentioned HTML_AJAX and 'callback' Rule. HTML5 validation can be used, but it isn't supported in IE and its support looks half-baked in other browsers.
 [2011-05-27 13:51 UTC] avb (Alexey Borzov)
-Status: Open +Status: Closed -Assigned To: +Assigned To: avb
Closing this as the implementation is already somewhat done.