General discussion

Locked

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.

1 total post (Page 1 of 1)  
| 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) {
alert('...');
result = false;
}
return(result);
}
When the form is submitted, it will call the function 'validate'. If the result from this function is false, the submission will be canceled.

Back to Web Development Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums