Reputation: 745
What I'm trying to do is create a simple form with a dropdown list and a submit button. Upon selecting an option from the dropdown list, the user clicks the submit button and a popup window opens that allows them to view more info about the option they selected.
Right now I simply have:
<form action="example.php" method="post" target="_blank">
<select size="7" name="identifier" style="width: 100%;">
<option>
Options....
</option>
</select>
</form>
Now this does 'work' as is in that when the user selects an option and presses submit, it opens a new window with the selected option post data passed along. However I would like it specifically to open a smaller popup window with a size I can define rather than a whole new window. I'm also aware target=_blank is deprecated so I'm wondering what would be the preferred way to achieve this now?
Upvotes: 0
Views: 8739
Reputation: 91
onsubmit
call a javascript function.
in that function get all the values you need to pass
e.g. var myelementval = document.getElementById('myelement')
then use
window.open('mywindow.php?myelement='+myelementval,"mypopupname","width=500,height=400,resizable=yes,top=100,left=200,scrollbars=yes"
.........
Upvotes: 0
Reputation: 2406
Try this
<form action="example.php" method="post" target='popup' onsubmit="window.open('','popup','width=700,height=400,left=200,top=200,scrollbars=1')">
Or add this code to your submit button : onclick="window.open('','popup','width=700,height=400,left=200,top=200,scrollbars=1')"
Upvotes: 0
Reputation:
Here is the link that may be solve your problem (stackoverflow Link) : how to show popup if select "option" in "select" dropdown using javascript?
Upvotes: 0