Form Validation not working

fullfusion 11 Nov, 2009
I have a form set up here http://www.ffdev9.net/index.php?option=com_chronocontact&chronoformname=ContactUs . I have validation turned on. If I have "Load Chronoforms CSS/JS Files" set to "no", then the form sends, but doesn't validate. If I have the "Load Chronoforms CSS/JS Files" set to "yes", when I hit submit, it goes to a page that says I don't have permission to access that page and I don't get the email from the form.

Any ideas on what's wrong?
nml375 11 Nov, 2009
Hi bullfusion,
This kind of behaviour usually suggests there's some malformed html-code in your form code. You could try disabling the checkToken security feature (form settings, general tab), and see if that helps.

/Fredrik
GreyHead 11 Nov, 2009
Hi fullfusion,

For me it both validates and submit - no error messages.

Bob
fullfusion 11 Nov, 2009
Perhaps I'm misstating the problem I'm seeing. When I leave the required fields blank, fields which are entered in the validation tab in the admin, the form still sends and doesn't require them to be filled in.
abriko 16 Nov, 2009
Same for me.
Why is it so difficult to do?

Here is my html code:

<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">name</label>
<input class="cf_inputbox required" maxlength="150" size="30" title="enter name" id="text_0" name="text_0" type="text" />

</div>
<div class="cfclear"> </div>
</div>

<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">Email</label>
<input class="cf_inputbox required validate-email" maxlength="150" size="30" title="enter email" id="text_1" name="text_1" type="text" />

</div>
<div class="cfclear"> </div>
</div>

<div class="form_item">
<div class="form_element cf_button">
<input value="Submit" name="button_2" type="submit" />
</div>
<div class="cfclear"> </div>




Enable validation: Yes:
Validation Library: Mootools
Run Validation onlyOnSubmit:Yes

1 - required (not blank) : text_0,text_1
7- validate-email (a valid email address): text_1

When i started using Chronoform, i was thinking that just check "required" in the form wizard was enough.. i think it should be, don't you think ?
abriko 17 Nov, 2009
I edited my previous message and i put the code from a form test with only 2 fields with no modification after wizard creation. I think that can limit the javascript errors. But it doesn't work either.
Any suggestion?
fullfusion 17 Nov, 2009
Bob, or anyone else, do you have any suggestions for abriko and I?
fullfusion 17 Nov, 2009

This kind of behaviour usually suggests there's some malformed html-code in your form code. You could try disabling the checkToken security feature (form settings, general tab), and see if that helps.



I don't see any problems in my HTML and turning of the checkToken didn't change anything, but thanks for the suggestions, Fredrik.

Here's my HTML for my contact us form

<div class="contentpaneopen-form">
<div class="contentheading">
	Contact Information
</div><br />
<div>
	<span style="float: right"><b>2020 S. Oneida Street, Suite 100<br />
	Denver, Colorado 80224</b><br />
	<br />
	Phone: (303) 759-4800<br />
	Fax: (303) 759-0509<br />
	<br /></span>
	<img src="/images/stories/mtnview_map.gif" /><br />
	<br />
	<small><a href="http://maps.google.com/maps?f=q&source=embed&hl=en&geocode=&q=2020+S.+Oneida,Denver,+Colorado+80224+&sll=37.0625,-95.677068&sspn=56.112526,95.449219&ie=UTF8&hq=&hnear=2020+S+Oneida+St,+Denver,+Arapahoe,+Colorado+80224&z=17&ll=39.680006,-104.907781" style="text-align:left">View Interactive Map on Goggle and to Get Directions</a></small>	<br />
</div><br /><br />
<div class="contentheading">
	Contact Us
</div><br />
<div class="required">
	Fields labeled in tan are required.<br /><br />
	First Name:  <INPUT NAME="first-name" SIZE=30 maxlength=68><br /><br />Last Name:  <INPUT NAME="last-name" SIZE=30 maxlength=68><br /><br />
	Email Address:  <INPUT NAME="email-address" SIZE=30 maxlength=68><br /><br />
	Phone Number:  <INPUT NAME="phone-number" SIZE=20 maxlength=68><br /><br />
</div>
<div>
	Street Address:  <INPUT NAME="street-address" SIZE=30><br /><br />
	City:  <INPUT NAME="city" SIZE=30><br /><br />
	State:  <INPUT NAME="state" SIZE=5>    Zip Code:  <INPUT NAME="zip-code" SIZE=15 maxlength=10><br />
	<br />
</div>
<div class="required">
	What is the nature of your inquiry?
</div>
<div>
	<INPUT TYPE="checkbox" NAME="inquiry-nature" VALUE="Prescription_refill">Need a prescription refill <br />
	<INPUT TYPE="checkbox" NAME="inquiry-nature" VALUE="General_question">General office question<br /><br />
	Comments:<br />
	<TEXTAREA NAME="Notes" ROWS="6" COLS="60"></TEXTAREA>
</div><br /><br />
<div class="required">
	Please enter the security code in the field below.
</div><br />
<div>
	{imageverification}<br />
	<input type='submit' value='Submit Form'>  <INPUT TYPE="reset" VALUE="Reset">
</div>
</div>


The odd thing is that the form requires me to choose one of the checkboxes but it doesn't require any of the "required" fields even though their names are in the required field on the validation tab.
fullfusion 17 Nov, 2009
abriko, do you have a closing div tag for the last div.form_item?

<div class="form_item">
<div class="form_element cf_button">
<input value="Submit" name="button_2" type="submit" />
</div>
<div class="cfclear"> </div>
nml375 17 Nov, 2009
Hi fullfusion,
I do notice that you've got dashes in your form field names, these tend to cause various issues with forms and php. Also, when using multiple checkboxes with the same name, make sure it's an array (suffix the name with []).
Finally, which I believe is the main source for your issues with validation, is that your form lacks the type-property for all inputs except the checkboxes and submit-button.

Hi abriko,
Could you post a link to the site/form?

/Fredrik
fullfusion 18 Nov, 2009
You the man, Fredrik!! The missing type values for the input fields were the culprits. I appreciate you responding.

As for the checkboxes, by suffixing the name do you mean name="inquiry-nature[]" or am I not understanding.

Thanks again for you help!
Max_admin 18 Nov, 2009
Hi fullfusion,

yes, please add the [] to teh field name and replace the - by _

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
fullfusion 18 Nov, 2009
Great, thanks for the reply!
abriko 18 Nov, 2009
Exactly ! That's it ! Thank you !!😀
I think i need to learn a little more templating joomla ^^
Tank you very much for your help !

The debug mode should tell something about it, don't you think ?
nml375 18 Nov, 2009
Hi abriko,
Well, for starters, did you remember to include a line such as this within the 'head'-block?
<jdoc:include type="head" />


/Fredrik
This topic is locked and no more replies can be posted.