Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Passing Javascript Variables to ASP?

  • 08-07-2009 2:14pm
    #1
    Closed Accounts Posts: 408 ✭✭


    Hey again everyone,

    I got my last problem sorted, and now I'd like to ask a more generic question please...

    Basically I use javascript to set table rows that are selected by the user's mouse to the class "selected".

    From here I want to use ASP to pick out that particular record in my table for editing.

    I'm using an XML file and javascript to generate my html table. My thinking is that I could possibly set my variable of the row id to the value of the position of the record.

    I.e. rowId = 1, applicant.position = 1, and load up the xml record using selectSingleNode().

    Does this sound remotely viable? Any comments are MORE than welcome as I'm tearing my hair out here trying to get my head around this problem.

    Cheers,

    Dan


Comments

  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    Can you change a hidden form field somewhere in that row with the JavaScript? Then it will be accessible to ASP through the Request.Form collection. Edit - or even just one hidden form field that's comma delimited or something.


  • Registered Users, Registered Users 2 Posts: 1,045 ✭✭✭Bluefrog


    Careful using comments as delimiters - could break if your data contains a comment - JSON is probably the most robust way of doing this kind of thing or failing that even something not commonly used like '|' would be an option.


  • Closed Accounts Posts: 408 ✭✭Chada


    I thought i'd come back to this thread to say thanks for the suggestions!

    I figured it out by passing the javascript variable through to asp by using a javascript variable link i.e.

    var srId = selectedRow.id;
    var url = applicants.asp?mode=updatedetail&selectedRowId='+srId+';

    Then request the variable as a string, and set it to the same position() as the applicant element using selectSingleNode.

    This will effectively compare the row id of the table with the position of the applicant element in the XML file.

    Hope this helps anyone else trying to figure out the same problem as me :)

    Dan


Advertisement