[Resolved] 2 Forms with one Submit Button?
Hi, is it possible to have 2 forms with one submit button.
I seem to have a problem since the action’s of the 2 forms are different.
These are my two forms. I have tried to combine them using a similar action but one of the submits wouldn’t work.
<form action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?>" method="post"> <form id="new_post" name="new_post" method="post" action="<?php bloginfo( 'url' ); ?>/">
How can I have both of the forms with one submit button?
If I can’t how can I combine them so that the information of the form is processed.
If your wondering, I am basically trying to to combine QuickPress and WP-polls together.
With JS you can.
Havn’t tried it myself, but you’re certainly not the first person to ask… 🙂
Is it because the actions are different?
Well certainly if you have two different actions then it’s not going to work, you can’t submit to two seperate URLs at once.
If you’d like to expand on what it is you’re trying to do, i’ll see if i can offer any further suggestions.
If you know the WP-Polls plugin it operates inside of wordpress admin. I managed to get it to work outside of wordpress admin and inside the site. WP-Polls uses embed feature: Example: “[pollid=2]” onto a post. So i found out that the embed also works on quickpress. So now what I am trying to do is get both forms into one page with one submit button. Both of the forms work, but the problem is im trying to make them work together. 2 Forms, 2 different actions, 1 submit button.
Above i showed the code for both of the forms. Top one is for wp-polls and bottom one is for quickpress. I tried to change the actions but it would disable one of the functions, either quickpress or wp-polls. So this is why I am trying to do 2 forms on one page with a submit.
WordPress.com has WP-Polls intergrated with the QuickPress widget (i use a WordPress.com blog), i wonder how it was done there.
Why wonder actually .. (looked whilst writing the reply)
<a href="admin.php?page=polls&iframe&TB_iframe=true&width=640&height=632" onclick="return false;" id="add_poll" class="thickbox" title="Add Poll"><img src="/wp-content/admin-plugins/polldaddy/polldaddy.png" alt="Add Poll"></a>
Looks like they use the thickbox modal(what the media uploads, theme preview and various other bits use) for loading the polls plugin.
Im confused, how does this solve my problem?
What im trying to do is get both the polls to submit and the quickpress content.
So on a separate page (outside of wordpress admin) i had setup the wp-polls. The Add Poll form. So people can create the poll with the content rather than going to the poll, then getting the id for it and making the post. Basically AIO form.
I really appreciate your help.
No it doesn’t solve the problem, i don’t know how to solve it unfortunately, i was just pointing out that WordPress.com uses polls in the QuickPress widget and how they do it, if it’s over your head then it probably didn’t help much.
I’ve realised my previous statement was actually wrong, wordpress.com uses the polldaddy plugin, not wp-polls, and i’ve come up with something for you…(read on).
What about a jQuery solution that does the same thing as the post editor poll button?
One small downside, it always places the poll shortcode at the end of the content, keeps the script light, and saves me hours of time figuring out how to track the position in the content. If you can live with that, try out the code below (assuming you still have wp-polls activated), most of the code below is borrowed from that plugin..
Can be placed in your theme’s functions.php to make it easy.. (can convert into plugin if you have a problem copying the above into your functions file).
You’ll see the poll image next to the other media buttons in the QuickPress widget, it will work exactly the same as the button you have in the main post editor, with exception to tracking where your cursor currently is in the content.
- The topic ‘[Resolved] 2 Forms with one Submit Button?’ is closed to new replies.