php - Set different targets for form with multiple submit buttons -


i have form contains wysiwyg editor, , 2 submit buttons :

<input type='submit' name='pdf' value='pdf preview'/> <input type='submit' name='save' value='save'/> 

"pdf" action displays content of editor pdf output. "save" action regular form submit. want pdf output open in new tab, , can't figure how that.

there no "target" attribute "input" tag. add "target=_blank" "form" tag, submit "save" action in new tab well, don't want.

i tried replace "pdf" submit button :

<a href="same_page" target="_blank" onclick="submitform();"> 

that didn't work. form submitted in current tab , new tab query receives nothing in $_post.

is there magic trick don't know yet ?

note : server-side code php

use button , onclick event jquery.

<button type='submit' name='pdf' onclick="$('form').attr('target', '_blank');">pdf preview</button> <button type='submit' name='save' onclick="$('form').attr('target', '');">save</button> 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -