Help in referencing object
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Help in referencing object

From: <amerar@iwc.net>
Date: Tue Jan 24 2006 - 21:18:27 CET

Hi All,

I'm not a javascript programmer, but I'm trying to accomplish something
here that is not working.

I have 2 buttons on an HTML form, along with several text fields. If
Button #1 is clicked, I only want to validate some of the text fields,
if Button #2 is clicked, I want to check them all.

I'm having trouble referencing the button name that was clicked.
Snippets of my code is below, if someone can help me please.

Thanks

.
.
.
<script language="javascript">
function validate(thisform) {
with (thisform)
 if (thisform.action.value == "Duplicate") {
   if (emptyvalidation(subject,"Subject is empty")==false)
{subject.focus(); return false;}
 }
 if (thisform.action.value == "Save") {
   if (emptyvalidation(subject,"Subject is empty")==false)
{subject.focus(); return false;}
   if (datevalidation(PartyDate,"Please select a valid Date")==false)
{PartyDate.focus(); return false;};
   if (valButton(party_domain) == null) {alert('No Party Location
selected'); return false;};
   if (isOneCheckboxChecked(thisform) == false) {alert('No List
Selected'); return false;};
}}
.
.
.
<FORM NAME='NEW_MENU' ACTION='sched.pl' METHOD=POST onsubmit="return
validate(this)">
.
.
.
<input type='submit' name='action' VALUE='Duplicate'
onclick="validate(this);">
<input type='submit' name='action' VALUE='Save'
onclick="validate(this);">
.
.
.
Received on Tue Feb 7 21:21:30 2006