Forums

range validation

rodiusd 27 Jul, 2013
Hello,

after a lot of searching on the forum i got me a test form created with two field and a submit button.
in the form i activated the JS validation and set the Errors event to "onSubmit & onBlur".

On the field in put in the class => "validate[digit[0,300]], game" without the quotes. Also on the validation i checked the digit validation.

The game class is to test a CSS setting for the field width.

When i put alpha characters in the field then i receive an error message to indicate that there must be digits entered. This i receive when leaving the field. However when i enter a value like 500, when leaving the field then i don't get any error message.

Any help here?
GreyHead 27 Jul, 2013
Hi rodiusd,

What do you see in the Form HTML? I suspect that you now have two Class attributes, try un-checking the digit validation.

Bob
rodiusd 27 Jul, 2013
Now nothing is working, onSubmit nor the onBlur. Include the HTML code of the form.

<div class="ccms_form_element cfdiv_select" id="input_select_11_container_div" style=""><label>Label Text</label><select size="1" class="" title="" name="input_select_1">
<option value="No">No</option>
<option value="Yes">Yes</option>
</select>
<div class="clear"></div><div id="error-message-input_select_1"></div></div><div class="ccms_form_element cfdiv_text" id="input_text_31_container_div" style=""><label>check range</label><input maxlength="3" size="3" class="validate[digit[0,300]], game" title="" type="text" value="0" name="input_text_3" />
<div class="clear"></div><div id="error-message-input_text_3"></div></div><div class="ccms_form_element cfdiv_submit" id="input_submit_21_container_div" style="text-align:left"><input name="input_submit_2" class="" value="Submit" type="submit" />
<div class="clear"></div><div id="error-message-input_submit_2"></div></div><div class="ccms_form_element cfdiv_empty" id="empty_container_div" style=""><div class="clear"></div><div id="error-message-empty"></div></div>


Question do we need the comma after the validate?
GreyHead 27 Jul, 2013
Hi rodiusd,

Just to experiment please make the Yes/No Select box required - that should force the validation code to be loaded. (Please see this FAQ for more about how the code is loaded.)

The comma isn't needed but it probably does no harm either.

Bob
rodiusd 27 Jul, 2013
have changed the dropdown to be required. Nothing changed. Already visited the faq before this to check on how JS validation is working.
rodiusd 28 Jul, 2013
Any other ideas, i'm really stuck here.
GreyHead 28 Jul, 2013
Hi rodiusd,

I got this to work using this class:
validate['digit[10,100]','required']


Bob
rodiusd 28 Jul, 2013
Hi Bob,

this is not working for me. I could send you my test form?
rodiusd 28 Jul, 2013
Hi Bob,

got it finally working. Created a new form from scratch to not have to look up all defaults.
Put the validate in the class parm and left out the field check digit validation.

Its now working onBlur and onSubmit.

Thanks for helping out.
This topic is locked and no more replies can be posted.