I have this simple form:
<form ENCTYPE="multipart/form-data" action="story.php" method="POST">
<input type="submit" value="Show files">
<input type="hidden" name="emailp" id="emailp" value="">
</form>
I fill the "value" with a querystring parameter by external iframe and javascript. Ok. Now I need to send this data to a php file. My idea was go for autosubmit. Now I can do that with a button like "show files", but I dont need a button but something that send the value automatically. Is it possible do that?
I have this simple form:
<form ENCTYPE="multipart/form-data" action="story.php" method="POST">
<input type="submit" value="Show files">
<input type="hidden" name="emailp" id="emailp" value="">
</form>
I fill the "value" with a querystring parameter by external iframe and javascript. Ok. Now I need to send this data to a php file. My idea was go for autosubmit. Now I can do that with a button like "show files", but I dont need a button but something that send the value automatically. Is it possible do that?
Share Improve this question asked Jul 9, 2012 at 14:52 user840718user840718 1,6117 gold badges36 silver badges61 bronze badges 1- possible duplicate of Javascript autosubmit form – Oleg V. Volkov Commented Jul 9, 2012 at 14:59
2 Answers
Reset to default 4Call a this JS code that submits the form after you set the value of the input.
document.getElementById("storyForm").submit();
HTML:
<form ENCTYPE="multipart/form-data" action="story.php" method="POST" id="storyForm">
<input type="submit" value="Show files">
<input type="hidden" name="emailp" id="emailp" value="">
</form>
If you add an ID to that form you could do it like this .
$('#FORM_ID').submit();
with jQuery
form = document.getElementById('FORM_ID');
form.submit();
or with JavaScript
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745304548a4621632.html
评论列表(0条)