0
votes

I have a page with 2 iframes: one iframe consists of a html-form, and the other one is a graph that is controlled by the ouput of the form. I have included a javascript code that automaticaly submits when I change my choice in a dropdown menu, hence adapting the graph to the new parameters. This works perfectly when I have already submitted the form manually and then change the parameters. However, when I haven't outputted a graph before, and I change the parameters, the second iframe shows a copy of the form in stead of the graph.. Can anyone help me with this issue? I can't seem to find the problem.. This is a part of the code I used for the form:

<select id="Graf1" onchange="makeChoice5();updateSelect(this,'Graf2');this.form.submit();" name="graf1">
    <option value="other">---------- Kies ---------- </option>
    <option value="1">Temperatuur</option>
    <option value="2">Relatieve vochtigheid</option>
    <option value="3">Straling</option>
    <option value="4">Dendrometer 1</option>
    <option value="5">Dendrometer 2</option>
    </select>

And this is the code for the manual submit buttons:

<input type="submit"
style="
font-family: verdana;
font-weight: bold;"
value="Bekijk Grafiek" onclick="action='grafiek.php'; this.form.target='grafiek';return true;" >
</br>
<input type="submit"
style="
font-family: verdana;
font-weight: bold;"
value="Printvriendelijke versie" onclick="action='grafiekPrint.php'; this.form.target='grafiek';return true;" >
1

1 Answers

1
votes

It is tough to say without your entire form code and javascript, but my guess is that you don't have your target and action set up initially. Thus, when you submit it via the onchange, it doesn't have anywhere to go. However, when you click your buttons, you then set your form target and action, so future changes to your select will work, which seems to be exactly what you are experiencing. Thus, try putting this on your form:

<form target="grafiek"..>

and setting up your action variable on page load to the default you would like it to do.