CFForm Either / Or required


hi,

 

i have simple cfform required fields. able make either of 2 fields required, either email address field or fax number field. need 1 or other completed , tested on submit.

 

any ideas on how achieve this?

 

cheers
peter

hi peter,

 

two options:

 

1).  use javascript function checks see whether either of 2 fields other "".  javascript code activate based on "onclick" of submit button.  (nice in doesn't go , hit cf server)  ..sorry, javascript not par.

 

or

 

2).  write coldfusion code checks see if visitor has filled in 1 or other.  use code on page you're submitting to:

 

 

<cfparam name="form.email" default="">
<cfparam name="form.faxnumber" default="">

 

<cfif listlen(form.email) gte 1 or listlen(form.faxnumber) gte 1>

 

do something

 

<cfelse>

     <cflocation url="originalformpage.cfm">

</cfif>

 

cfwild



More discussions in ColdFusion Rich Forms


adobe

Comments

Popular posts from this blog

Help with codes to add 1 more shift register and add more to matrix LED

tcp client

Can't read sms using Thinker A7 communicate with Arduino