www.webdeveloper.com
Results 1 to 6 of 6

Thread: Remember all inputfields...

  1. #1
    Join Date
    Apr 2003
    Location
    Sweden
    Posts
    54

    Remember all inputfields...

    Hi,

    I have a problem.

    In an assignment I have to make a form in ASP, when you click on submit the form is sent to the server for validation.

    If all the inputfields are filled (correct) a ack.page will show, else the form will be displayed again... BUT now all the fields that where filled shall remain filled.

    I have tried everything (but the correct way) to do this, well with the text-fields there are no problem. But with the checkbox, the selectbox (there I have a solution, but not as nice as I would like) and the selectbox with multiple.

    Anyone?

    I use Javascript as my lanuage. So please use that, otherwise I have to try to understand VB...

    /Marcus

  2. #2
    Join Date
    Apr 2003
    Location
    Sweden
    Posts
    54
    Well, as soon as you ask for help you find the solution your self...

  3. #3
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    95
    What was the solution?!

  4. #4
    Join Date
    Apr 2003
    Location
    Sweden
    Posts
    54
    Well, it only solved the checkbox... and the solution is to on the condition of "Request("checkboxName").Count > 0" been true to add "checked" to the HTML.

    But that seems to be more complex this the singel- and multichoice-selectbox, that problem remains.

    /Marcus

  5. #5
    Join Date
    Jan 2003
    Location
    Dundee, Scotland
    Posts
    1,367
    hi,
    very simple to do. All you do is request the form objects in the usually way:

    Code:
    textbox1 = request.form("textbox1")
    checkbox1 = request.form("checkbox1")
    radio1 = request.form("radio1")
    Then in the original form you have the following code. Remember that the form has been posted back to itsself.
    For the textbox do this:
    Code:
    <input name="textbox1" type="text" value="<%=textbox1%>">
    For the checkbox do this:
    Code:
    <input name="checkbox1" type="checkbox" value="Value1" <%if checkbox1 = "Value1" then response.write "Checked" end if%>>
    and the radio:
    Code:
    <input name="radio1" type="radio" value="yes"<%if radio1 = "yes" then response.write "Checked"%>>

  6. #6
    Join Date
    Apr 2003
    Location
    Sweden
    Posts
    54

    Solved, but thanks anyway...

    I realized that I had misspelled ">="

    /Marcus

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles