• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

OT: simple html, js question

Zbox

Senior member
i'm creating this generic form, and don't want it to post unless two particular strings in the form match

what is the best way to implement this so that the user may not proceed unless the two strings match... is it possible to do this without js?

thanks 😉

-z
 
Implement a onSubmit function, which will catch all submit attemps even a pressed enter from user, and a click on button.

And no, not possible without code. But without js? Yes, you could use VB 😛
 
I would do it server-side, in PHP, for two reasons: 1) Some users may have JS disabled, or may not be using a brower that supports VB, so bad data could slip through; and 2) I don't know JS. 😉
 
jliechty: it sounds like he's doing both anyways. I'm sure whatever he's writing will check in on the server-side (sounds like passwords?) but he said
don't want it to post
which to me sounds like he's trying to save the client the time it takes to find out they made a mistake.

Now since I haven't actually contributed anything to the question so here's my little attempt (in case you haven't done it already 🙂):

<html>
<head>
<script type="text/javascript">
function checkSame() {
return (document.myForm.password.value == document.myForm.confirm.value);
}
</script>
<body>
<form name="myForm" onsubmit="return checkSame()">
<input type="password" name="password" />
<input type="password" name="confirm" />
</form>
</body>
</html>

Now I'm sure I didn't write that correctly the first time. Maybe someone can critique my effort?

Edit: fixing indentation
 
Back
Top