1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Rep Power

    Unhappy Dynamic textbox validation

    i am having trouble validating a piece of code that i cannot find out how to do...what i have is a form that is done in asp that loads info from the database...i have textfields that are dynamic and are an option to the user if they want to add comments...

    the user would click on the radio button indicating that they will use the textfield and then they would enter in there comments...the problem is, i am trying to create validation for this piece of code which is written in ASP...i don't want the user, when they click on the radio button to use the textfield, to submit an empty field into the database or submit illegal characters and numbers...this textfield should only be allowed to pass letters...how do i do this in javascript when the textfield has a dynamic name???? how do i call an ASP variable into javascript to do validation???any suggestions are welcomed???
    here is snippet of the code that contains the text field i want to validate from the ASP page...

    the part that i want to add validation is <input type=text name=wi" & currentposition & " size=50 value='Write-In'>, which you will see in the code below...

    Case "ED"
    If office_positions("Position")= Session("COLLEGE") AND Session("LEVEL")<>"GR" AND Session("LEVEL")<>"DR" Then
    If checkbox = "y" Then
    response.write "&nbsp;&nbsp;&nbsp;&nbsp;<input type=checkbox name=senator1 value=writein1>&nbsp;&nbsp;<input type=text name=wisenator1 size=50 value='Write-In'><br>"
    response.write "&nbsp;&nbsp;&nbsp;&nbsp;<input type=checkbox name=senator2 value=writein2>&nbsp;&nbsp;<input type=text name=wisenator2 size=50 value='Write-In'><p>"
    checkbox = "n"
    response.write "&nbsp;&nbsp;&nbsp;&nbsp;<input type=radio name=" & currentposition & " value=writein>&nbsp;&nbsp;<input type=text name=wi" & currentposition & " size=50 value='Write-In'><p>"
    End If
    response.write "<hr><b>&nbsp;&nbsp;Senator Collegiate - " & office_positions("Title") & "</b><hr>"
    if canidates("Canidate")="No Canidate" then
    response.write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;No Canidates are running for this position<br>"
    response.write "&nbsp;&nbsp;&nbsp;&nbsp;<input type=radio name=" & office_positions("Position") & " value=" & canidates("Canidate_id") & ">&nbsp;&nbsp;"
    response.write canidates("Canidate") & "&nbsp;&nbsp;(" & canidates ("Party") & ")<br>"
    end if
    lastposition = office_positions("Position")
    End If
  2. #2
  3. No Profile Picture
    Clueless llama
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2001
    Lincoln, NE. USA
    Rep Power
    You have the wrong forum. You want either the ASP or Javascript/html forum. This is for Java.

IMN logo majestic logo threadwatch logo seochat tools logo