refreshing page using javascript but retaining the

Results 1 to 2 of 2

Thread: refreshing page using javascript but retaining the

  1. #1
    Join Date
    Dec 1969

    Default refreshing page using javascript but retaining the

    i want my page to get refreshed but still able to retain the previous value at the time of selection of the list box.<BR> here is my script.&#060;td&#062; &#060;select name = cmbproj onchange = "refresh_me()" &#062; <BR> <BR>&#060;%<BR><BR> dim varPrjId<BR> varPrjId=request.Form("cmbproj")<BR><BR> set rs1 = server.CreateObject("adodb.recordset") <BR> rs1.Open "select distinct(projectname)from ihtproject",cn,adOpenDynamic,adLockOptimistic<BR> <BR><BR> if varPrjId="" then<BR> varPrjId = rs1("projectname")<BR> end if <BR> <BR> rs1.close<BR> <BR> <BR> <BR> sql = "select distinct(projectname) from ihtproject"<BR> set rs= server.CreateObject("adodb.recordset")<BR> <BR> rs.Open sql,cn,adOpenDynamic,adLockOptimistic <BR> <BR> rs.MoveFirst<BR> <BR> do until rs.EOF <BR> <BR> if varPrjId = rs("projectname") then<BR> Response.Write ("&#060;option value =" & rs("projectname") & " selected&#062;" & rs("projectname")& "&#060;/option&#062;")<BR> else<BR> Response.Write ("&#060;option value =" & rs("projectname") & " &#062;" & rs("projectname")& "&#060;/option&#062;")<BR> end if<BR> <BR> <BR> rs.MoveNext<BR> <BR> loop <BR> <BR> rs.close <BR> <BR> <BR>%&#062;<BR>&#060;/td&#062;&#060;/tr&#062;<BR>&#060;/select&#062;<BR><BR>function refresh_me()<BR>{<BR> <BR> var varprojname<BR> varprojname = document.frmcombo.cmbproj.value<BR> <BR> <BR><BR> document.location.href ="new asp page4.asp"<BR> <BR> document.frmcombo.cmbproj.value=varprojname<BR> <BR><BR> // document.frmcombo.txthidden.value = varprojname<BR> <BR> <BR> // alert (document.frmcombo.txthidden.value)<BR> <BR><BR>you might have understood by now that i am able to refresh the page on the onchange event of a list box but not able to retain the selected value. please help<BR><BR>thanks<BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: refreshing page using javascript but retaining

    Well refreshing the page will refresh the form fields, so anything you do to those fields prior to the refresh is irrelevant. Why not simply post the form, then you can pick up the values from request.form. Alternatively you could pass the selected value in a cookie or in the URL, but you have to pass it back to the server one way or another before you can use it.

Posting Permissions

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