Re: Form Field Validation - codon boundaries

2011-05-09 Thread Rick Colman

I should have provided more detail.

This has to do with nucleotide strings in DNA.

for example, consider the follow string:

123 456 789
act   gta  ccc ... (spaces not in string, just for clarity)

Any start position must begin at position 1,4,7, etc.
Any end position must conclude at position 3,6,9 etc.

So, I am not sure the function below would do exactly what I need??

On 5/7/2011 4:40 AM, Jason Fisher wrote:
 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: xxxstart [   ]   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:344357
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Form Field Validation - codon boundaries

2011-05-09 Thread Ras Tafari

i dont know how, but im going to say some regex work here would do the trick.

On Mon, May 9, 2011 at 1:51 PM, Rick Colman rcol...@cox.net wrote:

 I should have provided more detail.

 This has to do with nucleotide strings in DNA.

 for example, consider the follow string:

 123 456 789
 act   gta  ccc ... (spaces not in string, just for clarity)

 Any start position must begin at position 1,4,7, etc.
 Any end position must conclude at position 3,6,9 etc.

 So, I am not sure the function below would do exactly what I need??

 On 5/7/2011 4:40 AM, Jason Fisher wrote:
 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:344358
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm