Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

append querystring variable to URL on form submit

Status
Not open for further replies.

dinosf

Technical User
Dec 27, 2002
11
0
0
Hey guys -

I confess I don't know javascript well, I am writing an ASP.NET application and I need help with a snippet of code to accomplish something that .NET makes very difficult. Here's what I'm doing.

I have a page with a table of rates and deductibles, in this table is a series of dynamic controls that when clicked load information for another part of the page. I'm having trouble getting it to post correctly, so I came up wtih the idea of appending a querystring variable and retrieving it when the page posts back. What I need is a way to append a querystring variable and submit the form, at first I tried a hyperlink to the same page, but that reloaded the page from scratch. Any suggestions? Again I don't know js well at all what I'm looking for is something like what I use to open a new window, but to submit the form instead.

Here's how I do that

in the HTML page

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>

Here's how I create it in code rb_Select is a radiobutton that is created on the fly, though if it's a radiobutton, other button or link does not matter I can use any.

strResult = "MM_openBrWindow('../Clerical/ReconcileScannedItems.aspx?intDeposit=" & arrD(i, 0) & "','Deposits','navigation=yes,location=yes,status=yes,scrollbars=yes,resizable=yes,width=600,height=600');return true;"

rb_Select.Attributes("onclick") = strResult

Thanks for reading this, I've been struggling with this for 2 very long days.
 
You're better off creating hidden input fields with the data you want, and then programatically submitting the form using the "submit" method.

I would not go for a querystring option at all.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
I'm concerned that there will be a speed issue with that method, the queries and code to pull the correct rates in the first place are complex, to have to run it again, might be an issue as I'm already having timing issues and adding in another server intensive query on this, the busiest page of the application, could be a problem. Thank you for the suggestion though, I may, in the end, have no other choice.

Dean
 
Actually it's a moot issue the hidden field option won't work in this case, becuase I need to know which image button out of the ones generated was clicked, adding a hidden field at run time would not solve the problem, as if I could hook into the hidden field to indicate which one was selected, that would solve the issue of getting the value, which would make adding the hidden fields redundant. I don't think a querystring is the answer either now, I think a cookie would work best, then if the cookie exists, I can shag the value of the cookie. Though now I'm having an issue getting the value stored. The cookie is being created, but no value is being stored.

strResult = "document.cookie = 'TermID=" & arrR(j, 35) & "';"
b_Select.Attributes("onclick") = strResult
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top