Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q554 How can I determine if a checkbox on a form exists?

irt.org | Knowledge Base | JavaScript | Form 3.1 | Q554 [ previous next ]

Q554 How can I determine if a checkbox on a form exists?

Try:

<form name="myform">
<input type="checkbox" name="myfield">
</form>

<script language="JavaScript"><!--
if (document.myform.myfield)
    alert('myfield exists');
else
    alert('myfield does not exist');
if (document.myform.myotherfield)
    alert('myotherfield exists');
else
    alert('myotherfield does not exist');
//--></script>

Shaun writes:

I found that I had to use the eval expresssion:

eval(document.formName.fieldName)

Feedback on 'Q554 How can I determine if a checkbox on a form exists?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.