validating a required field using ajax

Conyard 07 Nov, 2011
Hi everybody,

I am currently having problems validating a select box as a required field when using ajax. The ajax I am using replaces a select box with the same html that is displayed when the form is loaded except it populates the select box with values from a query to the database.


<div class="ccms_form_element cfdiv_select" id="service_container_div"><label>Service</label><select size="1" style="width:250px;" label_over="0" hide_label="0" class="validate['required']" title="" type="select" name="service">
<option value='0'>No services available</option>
</select>
<div class="clear"></div><div id="error-message-service"></div></div>


Validation does not seem to work with HTML that has been created by the ajax. It works fine for a select box when not created by ajax.

To view the form, please visit:

http://bms.multihog.dev/index.php?option=com_chronoforms&chronoform=plan_services_test

Any help with this matter would be greatly appreciated.
GreyHead 17 Dec, 2011
Hi Conyard,

I'm sorry that this wasn't answered long ago. You posted just about when we got hit by the great 'spam storm' and some posts got lost in the debris :-(

Have you got it resolved? Just showing the class won't do it except when the form is first loaded but Form Check does have a Register method that lets you add validations as needed.

Bob
Conyard 06 Jan, 2012
Hi greyhead, thanks for this answer it has proved to be very useful! this has the solved the issue
This topic is locked and no more replies can be posted.