Forums

Default value in a simple form breaks validation

dikostaras 23 Apr, 2013
Hi,
i have created a simple contact form with label hide and default values as the labels.
When i have this customization the validation works only in the email field although the other two fields that i have are required.When i don't have a default value the validation works fine for every text box.I would appreciate any help.
Thanks
GreyHead 23 Apr, 2013
Hi dikostaras,

Well, yes, if you add a default value the input is not longer empty and a 'required' validation will no longer work. The validation code needs to remove or ignore the default values.

What code are you using?

Bob
dikostaras 23 Apr, 2013
Thanks for your reply,
i am using chronoforms 4.0 RC3.5.2,in a joomla 2.5.6.
The html code is
<div class="ccms_form_element cfdiv_text" id="input_text_11_container_div" style=""><label style="display:none;">Enter Your Name</label><input maxlength="150" size="30" class="swaptextbox validate['required']" title="" type="text" value="Enter Your Name" name="input_text_1" />
<div class="clear"></div><div id="error-message-input_text_1"></div></div><div class="ccms_form_element cfdiv_text" id="input_text_21_container_div" style=""><label style="display:none;">Your Email Address</label><input maxlength="150" size="30" class="swaptextbox validate['required','email']" title="" type="text" value="Your Email Address" name="input_text_2" />
<div class="clear"></div><div id="error-message-input_text_2"></div></div><div class="ccms_form_element cfdiv_textarea" id="input_textarea_31_container_div" style=""><label style="display:none;">Your Message</label><textarea cols="45" rows="12" class="swaptextbox validate['required']" title="" name="input_textarea_3">Your Message</textarea>
<div class="clear"></div><div id="error-message-input_textarea_3"></div></div><div class="ccms_form_element cfdiv_submit" id="input_submit_41_container_div" style="text-align:left"><input name="input_submit_4" class="btn" value="Submit" type="submit" />
<div class="clear"></div><div id="error-message-input_submit_4"></div></div>  


I have done any modification or add any custom code.
GreyHead 23 Apr, 2013
Hi dikostaras,

As I said before, if you set values then they must be removed when the validation runs.

Please see this FAQ

Bob
This topic is locked and no more replies can be posted.