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  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


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

2011-05-07 Thread Jason Fisher

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:344329
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Form Field validation tag -- need help (EBW)

2002-11-26 Thread S . Isaac Dealey
I would probably make the default for max longer than 1 -- 20 or 50 maybe...
20 is the default length for html form fields. 50 is the default size of MS
SQL Server varchar columns.

I would probably also use "" instead of "[not provided]" as the default for
fieldname and equalfieldname -- if len(trim(var)) is 0 then you know it
wasn't provided.

Doesn't look like this should be tough to convert to a UDF and I think it
would likely make it faster and easier to use...


function validateFormField(fName,fType,fValue) {
  var required = false;
  var fMin = "1";
  var fMax = "50";
  var eqVal = "";
  var eqField = "";
  var errormessage = "";

  // allow optional arguments
  if (arraylen(arguments) gte 4) { required = arguments[4]; }
  if (arraylen(arguments) gte 5) { fMin = arguments[5]; }
  if (arraylen(arguments) gte 6) { fMax = arguments[6]; }
  if (arraylen(arguments) gte 7) { eqVal = arguments[7]; }
  if (arraylen(arguments) gte 8) { eqField = arguments[8]; }

  // validate for the given field type
  switch (fType) {
case "string": { // check length of string for minimum and maximum
  if (len(attributes.fieldValue) lt attributes.min) {
errorMessage = "#attributes.fieldName# is less than the minimum
#attributes.min# characters."; }
  else if (len(attributes.fieldValue) gt attributes.max) {
errorMessage = "#attributes.fieldName# is more than the maximum
#attributes.max# characters."; }
  } break;
}
  }
  return errormessage;
}




You need a break; statement at the end of each case clause otherwise it will
continue processing with the next case in the list. In any event -- that
should get you going. :)


s. isaac dealey954-776-0046

new epoch  http://www.turnkey.to

lead architect, tapestry cms   http://products.turnkey.to

certified advanced coldfusion 5 developer
http://www.macromedia.com/v1/handlers/index.cfm?ID=21816

> For some reason, code after the HTML Horizontal Line Break
> was omitted.
> Here it is again:

>  default="[not provided]">
>  default="string">
>  default="">
> 
> 
>  default="No">
>  default="">
>  default="[not
> provided]">
>  type="variableName"
> default="errorMessage">

> 

>  (len(attributes.fieldValue) eq 0)>
>   
>  (len(attributes.fieldValue) eq
> 0)>
>   
> 
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>  Val(attributes.min)>
>   
>  Val(attributes.max)>
>   
>  Int(Val(attributes.fieldValue))>
>   
>   
>   
>   
>   
>   
>  Val(attributes.min)>
>   
>  Val(attributes.max)>
>   
>   
>   
>   
>   
>   
>   
>   
>  attributes.fieldValue) lt 1>
>   
>  attributes.fieldValue) lt 1) and
>   (REFindNoCase("[[:punct:]]", 
>attributes.fieldvalue)
>   lt 1)>
>   
>   
>   
>   
>REFindNoCase("([A-Z0-9-]{1,}\.)*([A-Z0-9-]{1,})(@)(([A-Z0-
> 9-]{1,})(\.))+([A-
> Z]{2,8})", attributes.fieldValue, 1, "TRUE") >
>  ((structEmail.len[1] lt
> len(attributes.fieldValue)) or (structEmail.pos[1] gt 1)))
> >
>   
>   
>   
>   
>  REFindNoCase("(([A-Z0-9-]{1,})\.)+([A-Z]{2,8})",
> attributes.fieldValue, 1, "TRUE") >
>  ((structWebsite.len[1] lt
> len(attributes.fieldValue)) or (structWebsite.pos[1] gt
> 1))) >
>   
>   
>   
>   
> 

>  errorMessage>

> -Original Message-
> From: Erik Britt-Webb [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 26, 2002 2:12 AM
> To: CF-Talk
> Subject: Form Field validation tag -- need help (EBW)


> I've developed a form field validation tag that seems to
> work reasonably
> well, but I'm thinking it would

RE: Form Field validation tag -- need help (EBW)

2002-11-25 Thread Erik Britt-Webb
For some reason, code after the HTML Horizontal Line Break was omitted.
Here it is again:















































































-Original Message-
From: Erik Britt-Webb [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 26, 2002 2:12 AM
To: CF-Talk
Subject: Form Field validation tag -- need help (EBW)


I've developed a form field validation tag that seems to work reasonably
well, but I'm thinking it would work even better as a UDF.  Does anyone
agree or disagree with that conclusion?  I'm attaching the code from the
custom tag below because I don't really know how to structure the CFScript
to accomplish the same goal as CFML.  If someone could help me get started
with the CFScript, I would greatly appreciate it.  Comments on the overall
approach are also welcome.  Thanks - Erik


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm



Re: Form Field Validation - No Spaces

2000-05-25 Thread Andrew C. Davis

Dick Applebaum wrote:
> 
> 
>...contains data
> 
>... spaces only
> 
> 

Thanks Dick!

Andrew C. Davis ([EMAIL PROTECTED])
TAMMIS Website Administrator / Systems Administrator
Metrica, Inc. * San Antonio, TX
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



Re: Form Field Validation - No Spaces

2000-05-25 Thread Randy Adkins

Here is a question for people who have knowledge in Storedprocedures
and SQL 7.0 backing.

I am using CFSTOREDPROC and passing my variables into it without a problem.
My Stored Proc in SQL is using the Order by clause.

This does not work.. Any idea on another solution?
I have used the query analyzer and it stated Order By is not support by SQL.

What gives?


- Original Message -
From: "Dick Applebaum" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 25, 2000 9:26 AM
Subject: Re: Form Field Validation - No Spaces


> 
>...contains data
> 
>... spaces only
> 
>
>
> At 8:13 AM -0500 5/25/2000, Andrew C. Davis wrote:
> >I have a form that has fields that, when validated, allow the user to
> >enter "spaces".  I want to be able to check for fields that contain only
> >spaces and then inform the user that they must enter text.  How do I do
> >this?
> >
> >Andrew C. Davis ([EMAIL PROTECTED])
> >TAMMIS Website Administrator / Systems Administrator
> >Metrica, Inc. * San Antonio, TX
>
>---
---
> >Archives: http://www.eGroups.com/list/cf-talk
> >To Unsubscribe visit
> >http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_tal
> >k or send a message to [EMAIL PROTECTED] with
> >'unsubscribe' in the body.
>
> --

> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



RE: Form Field Validation - No Spaces

2000-05-25 Thread Henry, David B

Andy,

It is possible to remove this complexity from the users by using a cfif
along with the trim function.


code ...


This This would strip all of the spaces out from the beginning and end of
the form field string.  

If this is not what you are looking for, let me know.  I hope this helps.


David Henry
HPER Technology Services
School of Health, Physical Education and Recreation
Indiana University 
(812)855-4270
[EMAIL PROTECTED]


-Original Message-
From: Andrew C. Davis [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 25, 2000 8:14 AM
To: Cold Fusion List
Subject: Form Field Validation - No Spaces


I have a form that has fields that, when validated, allow the user to
enter "spaces".  I want to be able to check for fields that contain only
spaces and then inform the user that they must enter text.  How do I do
this?

Andrew C. Davis ([EMAIL PROTECTED])
TAMMIS Website Administrator / Systems Administrator
Metrica, Inc. * San Antonio, TX

--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



Re: Form Field Validation - No Spaces

2000-05-25 Thread Dick Applebaum


   ...contains data

   ... spaces only



At 8:13 AM -0500 5/25/2000, Andrew C. Davis wrote:
>I have a form that has fields that, when validated, allow the user to
>enter "spaces".  I want to be able to check for fields that contain only
>spaces and then inform the user that they must enter text.  How do I do
>this?
>
>Andrew C. Davis ([EMAIL PROTECTED])
>TAMMIS Website Administrator / Systems Administrator
>Metrica, Inc. * San Antonio, TX
>--
>Archives: http://www.eGroups.com/list/cf-talk
>To Unsubscribe visit 
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_tal 
>k or send a message to [EMAIL PROTECTED] with 
>'unsubscribe' in the body.

--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.