If startVal, endVal, and lengthVal represent your values in JS [like var 
startVal = parseInt(myForm.start.value); ], then the following should work:

if (startVal % 3 != 0) {
     alert("Start must be a multiple of 3.");
     return false;
} else if (endVal % 3 != 0) {
     alert("End must be a multiple of 3.");
     return false;
} else if (endVal < startVal) {
     alert("End must be larger than Start.");
     return false;
} else if (endVal > lengthVal) {
     alert("End cannot be larger than Length.");
     return false;
}
return true;

You could put that into a function and call the function on the form 
onsubmit(return myFunction()).


On 5/6/2011 5:51 PM, Rick Colman wrote:
> I have the following:
>
> length: xxx    start [       ]   end [     ]
>
> I would like to test for the following conditions:
>
> * must be an integer
> * start and end must be evenly divisible by 3
> * end cannot exceed length
>
> CFINPUT works for type test, but not sure how to generate the javascript
> validation that would be required.
>
> Rick.
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344329
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to