Detecting existence of object

Results 1 to 2 of 2

Thread: Detecting existence of object

  1. #1
    Join Date
    Dec 1969

    Default Detecting existence of object

    Is there a way to detect if an form object (text box, check box, etc.) exists on a page on the client side (JavaScript)? I need to validate some fields when user submits the page, but some of the fields are only generated by ASP under certain conditions from a previous page. I obviously can&#039;t do something like...<BR><BR>if (document.thisform.title.value == "")<BR><BR>... if .title. doesn&#039;t exist on the page. Thanks!<BR>

  2. #2
    Join Date
    Dec 1969

    Default document.thisform.title != null

    Or, to combine it:<BR><BR>...<BR>frm = document.thisform;<BR>if (frm.title != null && frm.title.value == "") alert("no value for title, dummy!");<BR>...<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts