Results 1 to 1 of 1

Thread: Passing a value through a submit button...

  1. #1
    Join Date
    Nov 2005

    Question Passing a value through a submit button...


    I have an ASP page which displays a row of data for each record in my database. For each record I want to display a view submit form button which when pressed, will pass the userID for the relevant record only to a separate ASP page using the form post method. e.g. "24"

    Within my table is the following for each record...

    <tr ...>
    <td> <input type="submit" onClick="viewrecord('<%=(rs.Fields.Item("UserID").Value)%>')" name="submitView" value="View"></td>
    <input type="hidden" name="UserIDField" value="<%= (rs.Fields.Item("UserID").Value) %>">

    and at the top of the page is the JavaScript function...

    function viewrecord( userID )

    // set the value of the hidden form field to the userID
    document.form1.UserIDField.value = userID;

    alert( "Now going to view the following record: " + userID + "; value of form field is: " + document.form1.UserIDField.value );


    However, the UserIDField is being passed all of the userIDs (i.e. "23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 1, 2, 3, 4, 5") rather than just the individual one I want (i.e. "18") even though the alert box is displaying the correct value of the individual record (e.g. "18").

    Any ideas? Is it a scoping issue?
    Last edited by ajaxilla; 11-21-2005 at 04:13 PM.

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