Passing varaibles between Forms

Hi,

Using ASP, VBScript and Javascript:

I have a HTML Form with multiple buttons, checkboxes and textboxes. Let's call it frmMain
Each button will launch a javascript function that will do a "Form.Submit".
However, one of those buttons will do a "pop-up" and launch another form. Let's call it frmPopup

Without using Request.QueryString (method="Get"), I want to put all the field values from frmMain into variables in frmPopup.

I tryed using Method="Post" action="popup.asp" in the <FORM> of frmMain. It works just fine because frmPopup 'knows' all the field values that were in frmMain. However, I have more than one button on frmMain and each button will show that popup form and I don't want that.

Is there a way to pass field values from frmMain to frmPopup without using querystring ?
LVL 1
mADOchistAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TeRReFCommented:
Maybe you could use a session:
http://www.w3schools.com/asp/asp_sessions.asp

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mADOchistAuthor Commented:
here is a sample of what I have....


-----------------------------------
frmMain
-----------------------------------
...

strCheckBoxDBID = request.Form("hidCheckBoxDBID")

...

<FORM id="frmMain" name="frmMain" Action="" Method="post">

...

<!-- This will need to be passed to frmPopup (Contains ID's of selected checkboxes-->
<INPUT type="hidden" id="hidCheckBoxDBID" name="hidCheckBoxDBID" value="<%=strCheckBoxDBID%>">

...

<INPUT type="button" id="cmdPopup" name="cmdPopup" value='Popup' onclick="PopupForm();">

...

function PopupForm()
{
/* Opens the popup window */  

      var winTextArea = window.open('popup.asp');
      winTextArea.focus();
}


-----------------------------------
frmPopup (popup.asp)
-----------------------------------

...

strCheckBoxDBID = Request.Form("hidCheckBoxDBID")
response.Write "strCheckBoxDBID = " & strCheckBoxDBID &  "<BR>"

...

<form id="frmPopup" name="frmPopup" Action="" Method="post" class="formStyle">

...
mADOchistAuthor Commented:
Yeah I could use session. I am totally new to WebDev. I used to do stand alone apps.:

Here are some questions:
->Can I add "Session" variables in javascript ? (I think the answer is "no" because javascript is client side)

->Can I call a VBScript sub when "cmdPopup" is clicked ?
If so then I could create my session variables and open the popup window. Is that possible ?

for example :

<INPUT type="button" id="cmdPopup" name="cmdPopup" value='Popup' onclick="VBSubPopupForm();">

.....

Sub VBSubPopupForm
    Session("CheckboxString") = strCheckBoxDBID
    window.open("popup.asp");
End sub


-----------------------------------
frmPopup (popup.asp)
-----------------------------------
strCheckBoxDBID = Session("CheckboxString")

response.Write "strCheckBoxDBID = " & strCheckBoxDBID &  "<BR>"

mADOchistAuthor Commented:
I tryed the following but I get error "Type Mismatch 'Session'"


<INPUT type="button" id="cmdPopup" name="cmdPopup" value="Popup" onclick="SetStatusTo(<%=cstRejected%>);">

</FORM>                        

<SCRIPT LANGUAGE="VBScript">
Sub cmdPopup_onclick
   Session("CheckboxString") = strCheckBoxDBID
   open "popup.asp"
End Sub
</SCRIPT>


-----------------------------------
frmPopup (popup.asp)
-----------------------------------
strCheckBoxDBID = Session("CheckboxString")

response.Write "strCheckBoxDBID = " & strCheckBoxDBID &  "<BR>"
Cem TürkSenior Software EngineerCommented:
you can use javascript in pop up window.

<script type="text/javascript>
document.write("strCheckBoxDBID=" + window.opener.document.form1.strCheckBoxDBID.value);
</script>
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.