I’m trying to use a select with an onChange event and I just need to show 2 possible selections, and the first one is selected by default.
The problems comes when you hit the submit button without changing the dropdown as it doesn’t work, any form is submitted. It is normal that it doesn’t work, because onChange event needs a change so that the value is selected. If I select the second option and select the first one again, it works.
Is there any way so that without changing the dropdown menu, the default value is selected and sent to the form?
<form action=javascript:action method="post">
...
<select name="selectType" id="selectId" onChange="this.form.action=this.options[this.selectedIndex].value;">
<option selected="yes" value="index.pl">At</option>
<option value="custom.pl">Pr</option>
</select>
</form>
Thank you very much in advance, and sorry if that’s a newbie question, I’m newbie.
Simply default the form action to
index.pl. It will be updated once theonChangeevent fires: