Web Development

General discussion


JavaScript: Document Object Model

By viplav76 ·
I have recently converted my Client-end scripts to 'JavaScript' from the original 'VBScript'. I did this as Netscape & other browsers (except IE) would not support VBScript. Yet the problem is not solved. I have written a validation function in <Script language="JavaScript"> tag. I address the form controls by the DOM method - formname.controlname.method. Please tell me, where am I going wrong.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by dfirefire In reply to JavaScript: Document Obje ...

There is not much code included to judge on, so this is a wild guess:
-make sure when your function gets called, you include a reference to the page itself, as is done in the following code:
<form ... onsubmit="return validate(this);">
-then use this reference in your function:
function validate(f){
result = true;
if (f['selectCustomer'].value == 0) {
result = false;
When the form is submitted, it will call the function 'validate'. If the result from this function is false, the submission will be canceled.

Related Discussions

Related Forums