• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CFform server side validation problem. Please help

Contributor ,
Feb 06, 2008 Feb 06, 2008

Copy link to clipboard

Copied

I am writting a contact form and using both client side validation and server sided validation. Something is wrong in my code and I can't figure it out. It isn't throwing an error, it just doesn't do anything when I send a form, or don't fill out the proper fields. It comes back blank. I am attaching my code. Can someone help me out?

Thank you.
Phoenix
TOPICS
Advanced techniques

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Feb 06, 2008 Feb 06, 2008
i think you got it wrong, ken... all that IS part of the email (what
would be sent otherwise? and empty email?) - the message in question is
the error message in strError var

---
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Votes

Translate

Translate
LEGEND ,
Feb 06, 2008 Feb 06, 2008

Copy link to clipboard

Copied

i think you are missing an onClick event in your image button which
should actually submit your form...
right now your form is not being submitted at all...

---
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 06, 2008 Feb 06, 2008

Copy link to clipboard

Copied

put <cfdump var="#form#">
<cfabort>

at the top of reponce.cfm. Do you see what you expected to see?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 06, 2008 Feb 06, 2008

Copy link to clipboard

Copied

This is what I get when I do a cfdump

ADDR1 [empty string]
ADDR2 [empty string]
CITY [empty string]
CNAME [empty string]
EMAIL mjc@phoenixdesignstudio.com
FIELDNAMES FNAME,LNAME,EMAIL,ADDR1,ADDR2,CITY,STATE,ZIP,PHONE,OFFICE,CNAME,MESSAGE,SUBMIT.X,SUBMIT.Y
FNAME
LNAME
MESSAGE test
OFFICE [empty string]
PHONE 518-392-5101
STATE [empty string]
SUBMIT.X 111
SUBMIT.Y 15
ZIP [empty string]

The form submits when I have it live with the code for the submit button that is there. Something is wrong in my responce code I think.

Phoenix

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 06, 2008 Feb 06, 2008

Copy link to clipboard

Copied

in your action page, try <cfif isdefined('form.submit.x') AND
form.submit.x> instead of <cfif isdefined('form.submit')> you have now...
does you client-side validation run properly?

---
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 06, 2008 Feb 06, 2008

Copy link to clipboard

Copied

That worked for that part of it. Now when you fill in the proper fields my cfoutput doesn't show what you sent and give the message. I think this is the problem here &lt;cfif strError EQ &quot;&quot;&gt; What would make this work?

My client side validation works on teh contact.cfm page, but not on the form on the responce page if you didn't fill out the proper feilds.

Any ideas?

Thanks.

Phoenix

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 06, 2008 Feb 06, 2008

Copy link to clipboard

Copied

is image an valid type of cfinput?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 06, 2008 Feb 06, 2008

Copy link to clipboard

Copied

no it is one I wrote and seemed to work before I wrote the server sided validation code. Is there a better way to use it? or should I go back to a cfinput that is done up with css? Right now it works to the point of my last post. It just doesn't show the message when you fill in the blanks correctly and the form validation for client side doesn't work on the responce page. Works fine on the contact.cfm page.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 06, 2008 Feb 06, 2008

Copy link to clipboard

Copied

image is a valid cfinput type, yes

---
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 06, 2008 Feb 06, 2008

Copy link to clipboard

Copied

Good, now is there a way to get the rest of my code to work? It does send email the way it is, but doesn't show the message. Any ideas?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 06, 2008 Feb 06, 2008

Copy link to clipboard

Copied

do you mean the strError is not displayed when the form data has errors?
strange...
a) debug it: add <cfdump var="#strError#"> right after your validation
cfif block.
b) have you posted all the relevant code from your page? have you
omitted some code that may interfere with the cfif logic?
c) just to rule it out - give your form in responce.cfm page some other
NAME... REQUEST is also a CF scope, so who knows what kind of confusion
may be going on behind the scenes there...


---
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 06, 2008 Feb 06, 2008

Copy link to clipboard

Copied

If you mean it is not showing the message on the page, that is because all
of the code is in the <cfmail>

Just add the following after the closing </cfmail> and before the <cfelse>

</cfmail>
<p>Thank you for submitting our form.</p>
<p>You submitted the following information:</p>
<cfoutput> <b>Status:</b> <b>Product Request!!</b><br>
<br>
<b>Customer First Name:</b> #form.fname#<br>
<b>Customer Last Name:</b> #form.lname#<br>
<b>Customer Email:</b> #form.email#<br>
<b>Customer Address 1:</b> #form.addr1#<br>
<b>Customer Address 2:</b> #form.addr2#<br>
<b>Customer City:</b> #form.city#<br>
<b>Customer State:</b> #form.state#<br>
<b>Customer Zip Code:</b> #form.zip#<br>
<b>Customer Home Phone:</b> #form.phone#<br>
<b>Customer Office Phone:</b> #form.office#<br>
<b>Customer Company Name:</b> #form.cname#<br>
<b>Product:</b> #form.message#<br>
</cfoutput>
<p>Someone will contact you as soon as possible. </p>
<cfelse>

--
Ken Ford
Adobe Community Expert - Dreamweaver
Fordwebs, LLC
http://www.fordwebs.com


"Irish-Phoenix" <webforumsuser@macromedia.com> wrote in message
news:foe0c5$64i$1@forums.macromedia.com...
> Good, now is there a way to get the rest of my code to work? It does send
> email the way it is, but doesn't show the message. Any ideas?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 06, 2008 Feb 06, 2008

Copy link to clipboard

Copied

i think you got it wrong, ken... all that IS part of the email (what
would be sent otherwise? and empty email?) - the message in question is
the error message in strError var

---
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 06, 2008 Feb 06, 2008

Copy link to clipboard

Copied

LATEST
there is a cfquery on the page, it gived the address and name of business from the DB. Would that interfear?

&lt;cfquery name=&quot;contactInfo&quot; datasource=&quot;#sitedatasource#&quot; username=&quot;#siteUserID#&quot; password=&quot;#sitePassword#&quot; maxRows=1&gt;
SELECT companySettings.company AS ViewField1, companySettings.name AS ViewField2, companySettings.address1 AS ViewField3, companySettings.city AS ViewField4, companySettings.state AS ViewField5, companySettings.zip AS ViewField6, companySettings.phone AS ViewField7, companySettings.fax AS ViewField8, companySettings.companyID AS ID_Field
FROM companySettings
&lt;/cfquery&gt;
&lt;cflock timeout=&quot;2&quot; scope=&quot;application&quot; type=&quot;READONLY&quot;&gt;
&lt;cfset application.contactInfo=contactInfo&gt;
&lt;/cflock&gt;

and the cfoutput is before the sendmail.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation