pop up window with parameter from field on page (ASP / vb)

I have code that pops up a window with a parameter from my recordset.  However, one of the parameters is on the parent page and not yet sent to the database.  How can I alter the code to grab that paramater from the field on the page instead of the recordset ?

The page has 'form1' and field name 'ActualSellPrice'

https://www.teamsxyz.com/WebApps2.0/Media/JDCCalc/JDCCalculator.htm?<%= Server.HTMLEncode(MM_keepNone) & MM_joinChar(MM_keepNone) & "SELLING_PRICE=" & rsQuotes.Fields.Item("SellPrice").Value"%>

I was thinking something like this, but it doesn't work.

https://www.teamsxyz.com/WebApps2.0/Media/JDCCalc/JDCCalculator.htm?<%= Server.HTMLEncode(MM_keepNone) & MM_joinChar(MM_keepNone) & "SELLING_PRICE=" & document.form1.SellPrice.value"%>
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

nap0leonConnect With a Mentor Commented:
I'm sure some of this can be optimized.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<style type="text/css">
body {

#container {

<script type="text/javascript">
function LaunchPopup(page,width,height) {
	OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,location=no, scrollbars=yes,resizable=yes, dependent=no,directories=no, width=" + width + ",height=" + height + ",x=50,y=50");

function updateLink(value){
	var linkObj = document.getElementById('lnk_LaunchPopup');
	var linkURL = linkObj.getAttribute('data-URL');

	//Some fancy code to split data-URL into parameter:value pairs so you can add or replace the value for "SELL_PRICE" based on the 
	var qLen = linkURL.length
	var qStart = linkURL.indexOf('?') +1;
	var q = linkURL.substr(qStart, qLen);
	var updatedLinkURL = linkURL.substr(0,qStart);
	arrVarsNVals = q.split('&');

	if (arrVarsNVals != '') {
		for (var i = 0; i < arrVarsNVals.length; i++) {
			//locate the existing parameter and value
			thisparam = arrVarsNVals[i].split('=')[0];
			thisvalue = arrVarsNVals[i].split('=')[1];
			if (thisparam == 'SELLING_PRICE') {
				//found SELLING_PRICE parameter, set it to the value in the form
				thisvalue = value;
			updatedLinkURL += thisparam + '=' + thisvalue + '&';

	if (updatedLinkURL != linkURL.substr(qStart)) {


	<div id="container">
		<input type="text" name="ActualSellPrice" id="ActualSellPrice" value="" onblur="updateLink(this.value)"/>
		<br/><a href="javascript:void(0);" onclick="LaunchPopup(document.getElementById('lnk_LaunchPopup').getAttribute('data-URL'),'400','180');" data-URL="https://www.teamsxyz.com/WebApps2.0/Media/JDCCalc/JDCCalculator.htm?param1=value1&param2=value2&SELLING_PRICE=" id="lnk_LaunchPopup">Launch pop-up</a>

Open in new window

This uses an onblur event on the ActualSellPrice field to update the custom attribute "data-URL"  that resides on the link to the popup.  The guts of the updateLink function parse the existing data-URL value to locate the SELLING_PRICE parameter and place the value from the form field into that string.

Couple notes:
1- this does not handle a default value for ActualSellingPrice  If the field has a value of "5000" in it when the page loads, the URL will not pick up that value (unless you make it do that in your server-side code)
2- After processing through my function, the data-URL attribute has an extra & at the end of it... they ought not hurt anything, but you may check for them and and remove them.
3- this is all easier with jQuery, but you didn't say you had it, so I did it the 'old fashioned' way.
See if this helps:

It shows the code yo place in a pop-up that sets a value in the pop-up to a value from a form-field in the parent-window.
drelingerAuthor Commented:
Thanks for the suggestion, but I'm afraid it won't work in this situation.
I must get the parameters into the URL.
The pop up is to an application not in my control, but was written to pull values from the URL.
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

"Page 1" has field in it and a link to this popup, right?

page contains a field where the user enters a value:
<input type="text" name="ActualSellPrice" id="ActualSellPrice">

Open in new window

and the page contains a link that opens a popup:
<a href="javascript:void(0)'" onclick="newWindow('SomeURLHere');">Launch pop-up<</a>

Open in new window

If so... a little javascript can set/update the link's URL.
Am I on the right track?
drelingerAuthor Commented:
yes.  you are on to it.
what syntax for the javascript ?
drelingerAuthor Commented:
you got me down the right path - thank you...
All Courses

From novice to tech pro — start learning today.