what am I doing wrong

Results 1 to 2 of 2

Thread: what am I doing wrong

  1. #1
    Join Date
    Dec 1969

    Default what am I doing wrong

    I am making dynamic text boxes here from db...and trying to do js validation to check if field is filled then alert...I am using Bill W. code that he posted earlier but I guess I am dumb enough to change it for text boxes any ideas what is wronh here<BR><BR>function searchClause() <BR>{ <BR> var CBs = document.admin_search.search_value; <BR> var counter = 0; <BR> for ( var cbNum = 1; cbNum &#060; CBs.length; ++cbNum ) <BR> // { <BR> // count all the checked checkboxes <BR> // if ( CBs[ cbNum ].value == "" ) ++counter; <BR> //} <BR> //if ( counter == 0 ) <BR> if ( CBs[ cbNum ].value == "" ) //++counter; <BR> { <BR> alert( "Please enter a search criteria." ); <BR> return false; <BR> } <BR> //if ( counter == 0 ) <BR> //{ <BR> // alert( "You checked more than one checkbox.
    Please check only one." ); <BR> // return false; <BR> /// }<BR> <BR> else<BR> {<BR> //document.adminform.action = "admin_viewTableData.asp" <BR> //document.adminform.submit(); <BR> return true; <BR> }<BR>}

  2. #2
    Join Date
    Dec 1969

    Default RE: what am I doing wrong

    what is search_value in the following line:<BR>var CBs = document.admin_search.search_value; <BR>I think it is the "text box" name on the form, am i right?<BR>if so then you need another property with it like this:<BR>var CBs = document.admin_search.search_value.value; <BR>&#062;&#062;better yet when anyway u have to check the length of the above why dont do this directly:<BR>var CBs = length(document.admin_search.search_value.value); <BR>and then in the "for..clause" do this:<BR>for ( var cbNum = 1; cbNum &#060; CBs; ++cbNum ) <BR>.<BR>.<BR>.<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