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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please Help! Problems with ASP/Javascript interaction & frames

Status
Not open for further replies.

questhaven

Programmer
Mar 28, 2001
81
0
0
US
Below you will find my original post in the javascript forum - from which I was told is not feasible because ASP does not work this way, and to try and post here for ideas for a work around. I desperately need to find another solution!

What I am trying to do is launch a pop-up that contains a drop down menu. Based on what is chosen in the drop down menu, an asp function needs to be called, and the value returned to the opening window. I was trying to post the form in the pop-up with javascript so I could maintain the location of the opening window, however - since I can not get the value from the drop down if I post it though javascript, I am at a loss. Does anyone have any ideas?

ORIGINAL POST: Hi there - I would really appreciate any help anyone could give me. I am trying to get the value of the drop down in the form below, which I am submitting using javascript, and use it within an ASP function, prior to submitting the results of that ASP function to the opening page. I have included my code below. The form value would need to go between the code that says "##FORM VALUE NEEDS TO BE HERE##".

Is this even possible? I feel like I have tried everything!

<HEAD>
<%templateMSG= parseTokens(##FORM VALUE NEEDS TO BE HERE##, 743,3 ,0,0)%>
<script language=javascript>
function sendValue(s){
var selvalue = s.options[s.selectedIndex].value;
top.opener.document.NoteForm.message.value = ' <%=templateMSG%> ';
}
</script>
</HEAD>
<body>
<%
dim txtTemplate
Response.Write(&quot;<form name=selectform>&quot;)
Response.Write(&quot;<INPUT type=&quot;&quot;hidden&quot;&quot; name=&quot;&quot;action&quot;&quot; value=&quot;&quot;2&quot;&quot;>&quot;)
Response.Write(&quot;<INPUT type=&quot;&quot;hidden&quot;&quot; name=&quot;&quot;winOpen&quot;&quot; value=&quot;&quot;&quot;&quot;>&quot;)
txtTemplate = cboGenericDropDownDetails(&quot;0&quot;, &quot;txtTemplate&quot;,&quot;&quot;,&quot;exec sql_Templates&quot;)
txtTemplate = cboGenericDropDownSelect(txtTemplate, templateID)
Response.Write(&quot;<P>Choose a template: &quot; & txtTemplate & &quot; <input type=button value=&quot;&quot;Add&quot;&quot; onClick=&quot;&quot;sendValue(this.form.txtTemplate);&quot;&quot;>&quot;)
Response.write(&quot;</form>&quot;)
%>
</body>
 
>> Based on what is chosen in the drop down menu, an asp
>> function needs to be called

opening page
<name=foo> mypage.asp


launches --> window.open(&quot;popup.asp&quot;)

user selects menu item in <select> element and clicks Submit. Popup submits <form> element to target.asp page:

<form target=&quot;foo&quot; action=&quot;mypage.asp&quot; ...>

Asp function that needs to be called is in mypage.asp and is exectuded based on whatever logic you want to use, like a hidden form variable in the popup <form>.

-pete
 
Hi Pete - My problem is that I can't have the opening page (which is actually the left portion of a frame set) be posted to, because it would refresh the contents. There is too much unknown user data that could possibly exist on this page that would be wiped out if the page refreshed. This is why I was trying to post back to an area of the page with this: top.opener.document.NoteForm.message.value = ' <%=templateMSG%> '; - so that the text area would be filled with the correct value. Unfortunately there needs to be some interaction with an ASP function in order to determine the value of templateMSG, so I can not sure how I can go about that. Does that make sense?
 
>> post back to an area of the page

Well of course you can't do that. You can only post to frames.

You might be able to use XML and the load() function to point to an asp page that returns XML. You could use the querystring to send the asp page it's parameters. If you return an HTML fragment in the form of a valid XML document you can use the innerHTML property of the element (area) that you want to replace.

-pete
 
Hi - I'm sorry - I dont think I am explaining what I am trying to do clearly. I am trying to fill the value of a textbox within a frame, based on a selection made in a pop-up window. I have been doing it successfully, using javascript, but it only gives me the exact value of the drop-down from the pop-up.

My problem is that I need to use the value from the drop down in a query to get a value from the database, and then fill the text box with that value.

Because of the fact that I can't call an ASP function from within the javascript processing code, I am trying to find another solution for getting the value of the drop-down and running it through a function to get the value I actually need.

Does that make more sense?
 
>> Does that make more sense?

Yeah, and my last post still stands as a possible avenue for your solution. Only instead of using the innerHTML property, which was just a guess since you never said &quot;textbox&quot; until your last post, you would set the value of the text box with the value of a XML element that was retrieved using the MSXML control and the load() method.

-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top