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

testing - Detect whether test has failed within fixture -

android - Create single AAR file from multiple modules using Gradle -

AbotX : How do you create a parallel crawler that stays on and can be added to at run time from new requests -