Results 1 to 5 of 5

Thread: javascript one

Threaded View

  1. #1

    Thread Starter
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538

    Question javascript one

    1) Page1.htm - contains only a submit button control.
    2) User clicks this & sends page1 to Page2.asp
    3) Page3.asp contains <select> and hidden field.
    4) User selects from the combobox.
    5) This selection text is placed into the hidden field.
    6) The page then is then automatically submitted - to itself.

    4-6 keep going in a loop, every time the user chooses an entry, the page reloads. Now when the page loads, the combobox shows the default first entry. What I'd like is for this to show trhe last selected entry.

    What I've done is set up a body_onload event which loops through all the entries in the combobox and selects the one which matches the request pages hidden text field's text:
    Code:
    function SelectChosenGam() {
    	if (request.form("hidChosen") != "") {
    		var intCounter;
    		
    		for(intCounter=0; intCounter<theForm.combo1.options.length; intCounter++) {
    			if (theForm.combo1.options[intCounter] == Request.Form("hidChosen")) {
    				theForm.combo1.selectedIndex = intCounter;
    			}
    		}
    	}
    }
    This works fine when the page2.asp page is submitting to itself. But then I realised that page1.htm submits to this page also & doesn't have the hidden field. How can I trap for this please ?
    Last edited by alex_read; Nov 20th, 2001 at 04:57 AM.

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

Posting Permissions

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



Click Here to Expand Forum to Full Width