Validation

mortenosx 27 May, 2008
I just dont get it - how do i make my form with validation

My form code is.
<table>
<tr>
<td width="93">Dit navn:</td>
<td width="255">
<input name="dit_navn" type="text" value="" size="36" maxlength="100" />
</td>
</tr>
<tr>
<td width="93">Din e-mail:</td>
<td width="255">
<input name="din_e-mail" type="text" value="" size="36" maxlength="100" />
</td>
</tr>
<tr>
<td>Besked:</td>
<td>
<textarea name="besked" cols="35" rows="3" id="besked"></textarea>
</td>
</tr>
<tr><td></td>
<td>
{imageverification}
</td>
</tr>
<tr><td> </td>
<td>
<input type="submit" value="Send" />
</td>
</tr>
</table>
GreyHead 27 May, 2008
Hi mortenosx,

Click the validation tab, turn Validation on and put dit_nav-n,din_e-mail in the 'Required' box. Save. Refresh your form and check that it works.

Bob
mortenosx 27 May, 2008
WOW, this works great.

Can you also explain how i get the senders e-mail in the send from... Now it says din_email... when i get a mail from the form.
GreyHead 28 May, 2008
Hi mortenosx,

We don't recommend putting the submitter's email in the send from. The email is technically from the website not from the form submitter. Using submitter's email in the Reply To and From fields is a frequent cause of email problems.

It is still possible and you will find several versions in the forums here if you search on ReplyTo.

Bob
ladyb314 04 Jun, 2008
I don't understand what I am doing wrong, but I even tried making a test form using the exact html code from this thread and adding those field names to the validation required field, and it does not work. I can press send without filling in anything and it still sends.

I am using Joomla 1.5, the very latest Chrono Form component, and i used prototype and mootools, but neither worked.

It sends it to my email successfully though. What could I be doing wrong?
GreyHead 05 Jun, 2008
Hi ladyb314,

Check that you have validation turned on.

You've already done this so for other readers: Try both JavaScript libraries - prototype and mootools - in turn (mootools is preferred for Joomla 1.5 as it is used by Joomla).



If neither of these work then most likely there is a JavaSCript conflict with something else on your page.

View the page using index2.php in place of index.php (this removes all the other Joomla templating).

If validation now works then use FireBug in Firefox on the index.php page to see what is conflicting.

Bob
lennart 06 Jun, 2008
My problem seemed the same as Ladyb314.
Validation is on, tried prototype and mootools.

I thought to be clever and putted form code in a php <?php include 'contactformulier.php'; ?> and included this in Form HTML.

Nice plan, seemed to work, but did not work. Somehow validation doesn't work if u use php include.

Back to plan A: no php include!
GreyHead 06 Jun, 2008
Hi lennart,

No, validation doesn't work if you include your form code.

But there is a simple work-around. Turn validation on in ChronoForms but make no entries in the field boxes.

Then add the class attributes directly into your form HTML, like this
<input type='text' name='field_name' class='required' . . ./>
This will work OK.

Bob
fatyandao 16 Oct, 2008
I would like to add that the adding the "required" class to the input tag works. you can also add multiple classes to the input tag to ensure multiple validations.😀
This topic is locked and no more replies can be posted.