Quantcast
Channel: Adobe Community : Popular Discussions - ColdFusion
Viewing all articles
Browse latest Browse all 14291

CFForm validation and onclick before submit

$
0
0

I have been trying to validate a few fields before submitting a form. Once the fields are validated by CF I want to pop up a sign in form if the user is not signed in. However, the problem is that the sign in form is pop up without validation.

 

inquiry.cfm

 

<cfifnotisdefined("form.p1")>
  
<cfformname="inquire"action="inquiry.cfm"method="post">
  
<inputtype="hidden"name="p1"value="1">
  
<cfinputtype="text"name="email"size="50"maxlength="50"required="yes"autofocus="on"validate="email">
  
<cfinputtype="text"name="subject"size="50"maxlength="50"required="yes"validate="noblanks">
  
<cftextareaname="message"cols="45"rows="8"wrap="soft"required="yes"validate="noblanks"></cftextarea>
  
<cfifsignedin>
  
<inputtype="submit"value=" Send ">
  
<cfelse>
  
<inputtype="submit"value=" Send "onclick="signin();returnfalse">
  
</cfif>
<cfelse>
  do stuff....
</cfif>


The "signin" function will pop up the sign in form.

 

What I have tried so far besides the above:

  1. onSubmit instead of onClick. But I don't want to submit the form until the user is signed in. 
  2. putting the onClick in the CFFORM tag but CF validation and sign in screen will pop up at the same time. After dismiss the CF fields validation screen but only complete the sign in screen will submit the blank form i.e. no validation.
  3. using CFINPUT tag instead of INPUT. Made no difference but also messed up the button text.

 

Any help is appreciated. Thanks in advance.


Viewing all articles
Browse latest Browse all 14291

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>