invoking qForm validation on dynamically generated field (client side)

Go To StackoverFlow.com

0

I have a form that has an input field with name/id 'notes':

<input name="notes" type="text" id="notes" tabindex="5" value="" size="60" maxlength="300" class="fauxTextArea">

I'm using javascript to replace it with a text area resulting in this:

<textarea rows="5" cols="60" title="" tabindex="5" style="" id="notes" name="notes" class=""></textarea>

Then I have to validate it with qForms. Not much choice in replacing the field with a text area and no choice at all having to use qForms.

When I try to submit the form all fields get 'validated' except for the dynamic text area.

2012-04-04 20:11
by vector


0

... the fix was painfully simple. Since the dynamic field is added in the $(document).reday func, initializing and calling validation inside that worked like a charm.

$(document).ready( function(){
    $(".fauxTextArea").jqFauxTextArea( );// the dynamic gets added here
    objForm = new qForm("whitePapers"); 
    // the rest of qForm relates stuff ...
}
2012-04-05 13:09
by vector
Ads