PDA

View Full Version : Forms not be validated by formval.js?



Nexus
18-Mar-2011, 09:28 PM
Hi,

I've set up formmail and everything is working, I receive an email with the forms details and get the thank you reply back.

The problems I have is that the form does is not being validated at the client end, there is no form checking to see if it's a valid email address that has been entered or if the required fields are filled out. Should there not be some kind of onsubmit call to a function within formval.js?

Currently the contact.htm and the formval.js are residing in the same directory and the paths are correct.

I've included the top part of the contact form here:
----------
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
@import url(formdesigneruser.css);
</style>
<script type="text/javascript" src="formval.js"></script>
</head>
<body>
<form id="Contact" name="Contact" method="post" action="http://MYWEBSITE HERE REMOVED/formmail.php">
<div class="TectiteFormDesignerField">
---------

Any assistance would be great as currently without the client side validation of the form it's not of much use.

My grateful thanks in advance.

Richard

UPDATE:

I now get a message 'Please enter a value for this field' should I not put anything in the field which is great, so all I seem to be missing is a check to see if it is a valid email address, i.e. contains an @. Perhaps, this javascript does not check for this, can anyone confirm this?

russellr
24-Mar-2011, 09:23 PM
Hi,

Sorry for the delay in replying - we're moving premises.

You need to use the "conditions" feature of FormMail to test for email address format.

There are several posts on the forums with examples of how to do this. Here's one: http://www.tectite.com/vbforums/showthread.php?t=821

The JavaScript cannot check conditions at this time, though we are planning to implement this ASAP.

This means conditions will be checked after the form is submitted to FormMail.

In any case, server side is the only secure way of validating form entry, so the client side should only be viewed as "user friendly".