Re: Help with HTML_QuickForm2
| From: | Alexey Borzov | Date: | Wed, 07 Mar 2012 07:10:08 +0000 |
| Subject: | Re: Help with HTML_QuickForm2 | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-31445@lists.php.net to get a copy of this message | ||
Hi Rich,
On 07.03.2012 1:26, RIch Payne wrote:
Question? (icon for help):<html input element> Now, the (icon for help) is just basically a question mark icon that the user can click on. This pops up a modal window using jquery to give them some help text. Now I have all this working, except, if the user navigates through the form using the keyboard (tab keys) I get a javascript error when the focus goes from the icon to the next html input field. The error is: "form is undefined" Which comes from this piece of javascript (generated by the QF2 client side validation code I believe) qf.Validator.liveHandler = function (event) { event = qf.events.fixEvent(event); var form = event.target.form; if (form.validator) {<<<<<<< form.validator.runLive(event); } };Thanks, that's indeed a bug in this function. Here's what's happening: the function is attached as a global onblur / onfocusout handler to a form and catches all blur events for child elements. However, I missed an option that an element generating a blur event can be something other than a form field, in your case a link. Unlike form fields, the link does not have a "form" property, so there's the error you are seeing and that's why it works OK if you remove a link. Can you please try replacing the above function with qf.Validator.liveHandler = function (event) {
event = qf.events.fixEvent(event);
if (event.target.form && event.target.form.validator) {
event.target.form.validator.runLive(event);
}
};
and checking whether it fixes the problem?