...

View Full Version : What should I add or remove?



owt200x
12-12-2008, 08:25 PM
I was wondering if anyone could tell me anything I should add or remove, or anything on my contact forms

http://www.owt200x.us/contactform

There is 2 versions of the contact form, one uses OpenCaptcha while the other uses MathCaptcha.

I know the website looks bleh, I need feedback on the contact forms themselves.

Thanks,
Barry

Apostropartheid
12-12-2008, 08:51 PM
Were I in your position, I'd add some form of JavaScript validation (plus the server-side you already have, of course.)

owt200x
12-12-2008, 08:59 PM
the only javascript i can do is copy/paste. why add javascript validation? why have 2 when theres already one. could you explain why?

jerry62704
12-12-2008, 09:02 PM
The javascript happens on the client machine. No network/internet traffic involved. That makes it faster and cheaper.

owt200x
12-12-2008, 09:03 PM
i dont know javascript, so i have no idea how to add it

oesxyl
12-12-2008, 09:07 PM
the only javascript i can do is copy/paste. why add javascript validation? why have 2 when theres already one. could you explain why?
two reason pro:
- can help user with form validation before pushing submit to check with php
- afaik bots don't interpret javascript, you can use this to avoid spam

best regards

owt200x
12-12-2008, 09:33 PM
cant bots disable JS? anyway, i dont know how to code JS, im trying to find a JS form validation to look at now.

owt200x
12-12-2008, 09:43 PM
I use a JS submit once script in the form. which uses the OnSubmit tag inside the <form> area, can you use 2 OnSubmit tags? once for submit once, and one for JS form validation?

jerry62704
12-12-2008, 09:47 PM
function validateEmpty(fld) {
var error = "";

if (fld.value.length == 0) {
fld.style.background = 'Yellow';
error = "The required field has not been filled in.\n"
} else {
fld.style.background = 'White';
}
return error;
}

This is called by:

function validateFormOnSubmit(theForm) {
var reason = "";

reason += validateUsername(theForm.username);
reason += validatePassword(theForm.pwd);
reason += validateEmail(theForm.email);
reason += validatePhone(theForm.phone);
reason += validateEmpty(theForm.from);

if (reason != "") {
alert("Some fields need correction:\n" + reason);
return false;
}

return true;
}

This is called by:

<form name="demo" onsubmit="return validateFormOnSubmit(this)" action="test.htm">
<table summary="Demonstration form">
<tbody>
<tr>
<td><label for="username">Your user name:</label></td>
<td><input name="username" size="35" maxlength="50" type="text"></td>
</tr>
<tr>
<td><label for="pwd">Your password</label></td>
<td><input name="pwd" size="35" maxlength="25" type="password"></td>
</tr>
<tr>
<td><label for="email">Your email:</label></td>
<td><input name="email" size="35" maxlength="30" type="text"></td>
</tr>
<tr>
<td><label for="phone">Your telephone number:</label></td>
<td><input name="phone" size="35" maxlength="25" type="text"></td>
</tr>
<tr>
<td>
<label for="from">Where are you :</label></td>
<td><input name="from" size="35" maxlength="50" type="text"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input name="Submit" value="Send" type="submit" ></td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</form>

This is from this page (http://webcheatsheet.com/javascript/form_validation.php#required)

Disclaimer: I don't advocate using tables to format the form. I only put one of the tests as an example.

owt200x
12-12-2008, 09:52 PM
thanks, I will add javascript validation for the contact form in my next update.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum