/    Sign up×
Community /Pin to ProfileBookmark

Need explanation for the following:

Hi,

I’m having problems with the following script:

What does the following refer to??? And why is there no 20??

objform[19].
objform[21].
objform[22].
objform[23].

thanks for an explanation
Theodore


*******************************************************************

<!–Begin pop-up field script – when user clicks Ok script automatically
defaults to the next required field.–>
<SCRIPT language=javascript>
<!–

function setInvoiceno(num)
{
document.forms[“form”].Invoiceno.value = num;
}

function CheckFields(objform){

if(objform.Cardname.value==””)
return _Alert(objform.Cardname,”Name may not be empty.”);
if(objform.Address.value==””)
return _Alert(objform.Address,”Address may not be empty.”);
if(objform.City.value==””)
return _Alert(objform.City,”City may not be empty.”);
if(objform.State.selectedIndex == 0)
return _Alert(objform.State,”Please select State/Province.”);
if(objform.Zip.value==””)
return _Alert(objform.Zip,”Zip may not be empty.”);
if(objform.Phone.value==””)
return _Alert(objform.Phone,”Phone may not be empty.”);
if(!emailCheck (objform.Email.value))
{
objform.Email.focus();
return false;
}
if(objform.Email.value != objform.Email2.value)
return _Alert(objform.Email2,”Email address must be identical to the above one.”);
if(objform.CardType.selectedIndex == 0)
return _Alert(objform.CardType,”Please select Credit Card Type.”);
if(objform.Cardnum.value==””)
return _Alert(objform.Cardnum,”Card Number may not be empty.”);
if (validateCard(objform.Cardnum.value) == false)
return _Alert(objform.Cardnum,”The credit card number is invalid.”);
if(objform.ExpDate_Month.selectedIndex == 0)
return _Alert(objform.ExpDate_Month,”Please select Credit Card Expiration Month.”);
if(objform.ExpDate_Year.selectedIndex == 0)
return _Alert(objform.ExpDate_Year,”Please select Credit Card Expiration Year.”);
if(objform[19].checked || objform[21].checked || objform[22].checked){}
else
return _Alert(objform[19],”Please choose the program.”);
if(objform[23].checked)
{}
else
return _Alert(objform[23],”You must read and agree to the Purchase Agreement.”);

return true;

}

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@David_HarrisonMay 29.2004 — Well you didn't post the code where the function is triggered. I am assuming that a form is passed to the function and so the numbers will be references to the form elements.
×

Success!

Help @Theodore spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...