PDA

View Full Version : Directing to a frame with Post in the form.


ScottInTexas
03-18-2003, 07:29 PM
How do I direct the output from the asp into the frame using a post method on a form.


<form id="choices" method="Post" action="http://h.../virtual/.../getData.asp">
<select size="1" id="crackerSelect" onchange="SelectThis()">
<option selected value="--Select Cracker--">--Select Cracker--</option>
</select>
<select size="1" id="chartstyle" onchange="SelectThis()">
<option selected value="--Select Period--">--Select Period--</option>
<option value="qtr">By Quarter</option>
<option value="month">By Month</option>
</select>
<input type="hidden" id="plant"><input type="hidden" id="period">
</form>


I will change the javascript to load the two hidden inputs and that is where I would like to put the submit. What ever is sent back by the ASP I want in the frame that is currently receiving the info at the moment.


ChartFrame.location="http://.../virtual/.../getData.asp?plant=" + strPlant + "&period=" + strPeriod;

/* Maybe I should have this?

for (i = 0; i < plant.length; i++){
if (plant.options[i].selected)
strPlant = plant.options[i].text;
}
if (strPlant =="--Select Plant--"){
ChartFrame.location='about:blank';
return;
}
period=choices.chartstyle;
for (i = 0; i < period.length; i++){
if (period.options[i].selected)
strPeriod = period.options[i].value;
}
if (strPeriod =="--Select Period--"){
ChartFrame.location='about:blank';
return;
}

ChartFrame.location=choices.submit();




Sure appreciate your help.

raf
03-18-2003, 07:41 PM
Sory, but i have no idea what youre looking for.

If you have a frameset, with a form in one of these frames, then the asp page (or the output of it) will end up in this frame (=the frame you posted the form from.

If you have a frameset and you want the results to turn up in another frame (or the whole screen or in a popup), then you need to set a target in the formtag.

like this

<form name="FormName" action="zoeksoort_categorie.asp" method="post" target="resultaat">

(of coarse you can use targets like parent, new, ...)

Is this what you're looking for. If not, tell us more precise what you need.

ScottInTexas
03-18-2003, 08:15 PM
RAF,

I believe you gave me the answer. Target="ChartFrame". I'll try that. I am sorry I was vague. I was trying to be brief and must have been too brief.

For clarification (in case the previous answer doesn't work).

When the user selects from the two drop downs the value of each is used in the call to the asp so that they get the chart they want. The call to the ASP is written in the javascript so the Form tag has nothing in it excep an ID. The result is displayed in an iframe named ChartFrame. For example:

ChartFrame.location="path to asp/getData.asp?variable=value";

But with the form being a post method, I have to put the values in hidden inputs and then programatically invoke the submit event. I still want the results to go into the ChartFrame. My javascript now has the assignment of data to the hidden fields and the submit event. The form ID="choices", the hidden inputs are plant and period.

choices.plant.value="MyValue"
choices.period.value="anotherValue"
ChartFrame.location=choices.submit();

I am going to test this method. Right now I am getting an error on the period in the ASP. I'll let you know how this goes.

Thanks again,