Post form i themeplate Wordpress - wordpress

I'm building a form to integrate in WordPress. How can i prevent the form from displaying start.php as an new single page when submitting?. I would like to stay in the startform div inside the template. Right now I'm shipped to a new start.php page?
I've tried to change the action to correct path to start.php but it's still same problem?
My file is start.php, I'm using this code to display it:
<div class="startform">
<?php get_template_part( 'start' )?>
<div>
The form is in start.php:
<form method="post" action="start.php">
<input type="submit" id="up_vote" name="vote" value="newmember" />
<input type="submit" id="down_vote" name="vote" value="oldmember" />
</form>

I found my solution by adding the insert script on same page instead of action="start"
<form method="post">
<input type="submit" id="up_vote" name="vote" value="newmember" />
<input type="submit" id="down_vote" name="vote" value="oldmember" />
</form>

Related

how to button linked to a new page

I am using CodeIgnighter framework. In my view I want to change the page when I click the button.
I set the base_url correctly.
Insert
Modify
You can also do it like this :
<form action="imports/add_user">
<input type="submit" value="Insert">
</form>
<form action="imports/modify_user">
<input type="submit" value="Modify">
</form>

Using dropzone to attach images to a post in the wordpress media library

In a frontend new custom post creation form, I'm trying to replace a normal input type file with dropzone, but it doesn't upload the images to the server.
I have created a new div for dropping the files, and I have wrapped the previous input as a fallback inside my form:
<form id="new_post" name="new_post" method="post" action="#" class="dropzone" enctype="multipart/form-data">
<!-- other form fields here -->
<div class="dropzone-previews"></div>
<div class="fallback">
<input type="file" name="file[]" multiple="multiple" />
</div>
<input type="hidden" id="new_cpt_action" name="new_cpt_action" value="new_cpt" />
<input type="submit" value="submit" id="submit" name="submit" />
</form>
To make dropzone work with the code above, I have the following options in my script:
$(document).ready(function () {
Dropzone.autoDiscover = false;
$("#new_post").dropzone({
uploadMultiple: true,
addRemoveLinks: true,
previewsContainer: ".dropzone-previews",
});
});
When I click the submit button, the creation of the new post is triggered and everything works as expected, but the images are not uploaded and attached. The input type="file" works perfectly, but dropzone doesn't.
If the server is able to handle the files with a normal input, does anyone know I am missing on the dropzone option?
Many thanks!

Plone Search: get method to pass via URL to another site

I am using Plone 4.3 and the diazo bootstrap theme and want to use the site-search-form to pass the searchterms including two search-options to another site (catalog) via get method.
To achieve this I have modified the plone.searchbox template and changed some content of it:
<div id="portal-searchbox"
i18n:domain="plone"
tal:define="navigation_root_url view/navigation_root_url;
search_input_id view/search_input_id;">
<form id="searchGadget_form" method="get" enctype="application/x-www-form-urlencoded" accept-charset="utf-8" action="http://www.thecatalogadress.net/opensearch">
<div class="LSBox">
<input name="LOCATION"
type="hidden"
value="HAGENBIB" />
<input name="SG1.SG.HAGENBIB:SGHagenvk"
type="hidden"
value="on" />
<input name="QUERY_alAL"
type="text"
size="18"
value=""
title="Finden"
class="searchField" />
<input class="searchButton"
type="submit"
value="search"
i18n:attributes="value label_search;" />
<div class="LSResult" id="LSResult"><div class="LSShadow" id="LSShadow"></div></div>
</div>
</form>
</div>
By now the search term is passed, but the two input-options are not introduced in the URL thus the query in the catalog doesn't work.
The result I need as URL is http://www.thecatalogadress.net/opensearch?LOCATION=HAGENBIB&SG1.SG.HAGENBIB:SGHagenvk=on&QUERY_alAL=test
As I am new to plone I wanted to ask for a hint, where to look at or what to change in order to add the two input-options to the URL.
I think you're probably forgetting to add the proper ZCML directives for the override on the template take place.
Take a look at this tutorial on Overriding Viewlets.

Form with GET action does not redirect page (relative paths?)

I am trying to follow the advice from this question, on how to make an input field act like a link.
I have setup the form, and setup the URL.
Yet, when I click the input fields, nothing happens. It does not redirect me, and there is no console errors.
Any ideas on how to make this work?
Rendered source:
<form action="/ads/edit" style="display:inline;" method="get">
<input onclick="_gaq.push(['_trackEvent', 'Frontpage_Top_SaleBtn', 'click'])" type="button" class="button_green_big" value="Sælg virksomhed" />
</form>
<form action="/ads/editbuy" style="display:inline;" method="get">
<input onclick="_gaq.push(['_trackEvent', 'Frontpage_Top_BuyBtn', 'click'])" type="button" class="button_green_big" value="Køb virksomhed" style="margin-left: 10px;" />
</form>
My ASP.NET MVC code that renders this:
<form action="#Url.Action("Edit","Ads")" style="display:inline;" method="get">
<input onclick="_gaq.push(['_trackEvent', 'Frontpage_Top_SaleBtn', 'click'])" type="button" class="button_green_big" value="Sælg virksomhed" />
</form>
<form action="#Url.Action("EditBuy","Ads")" style="display:inline;" method="get">
<input onclick="_gaq.push(['_trackEvent', 'Frontpage_Top_BuyBtn', 'click'])" type="button" class="button_green_big" value="Køb virksomhed" style="margin-left: 10px;" />
</form>
as noted in one of the answers to the question on which you are referring
<form action="http://google.com">
<input type="submit" value="Go to Google">
</form>
Set your inputs type to 'submit' instead of 'button'

Form Variable Becomes Part of Link to Web Page

We are hosting a PURL site and the variable is at the end: http://mywebpage.com/first.last
Now the client wants a static web page where you go and enter a first and last, then on submit it goes to out PURL site.
Tried this with straight html but it's not going to work. On to ASP.
New to ASP and I'm trying to have a form that has 2 fields, first, last in a link. Here is the form concept:
<form id="form1" name="form1" method="post">
<p>
<label for="1">First Name:</label>
<input type="text" name="first" id="first" />
<label for="2">Last Name:</label>
<input type="text" name="last" id="last" />
</p>
<p><input type="submit" name="3" id="3" onclick="window.open('http://mywebpage.com/first=val1&.&last=val2')"/>
</p>
</form>
Any help to put me on the right tracks would be extremely welcome at this point.
Thank you,
Ed
Try this:
<form id="form1" name="form1" method="GET" action="http://mywebpage.com/" >
Then do a normal submit without onclick and window.open.
action will submit form to that URL, and method="GET" will pass form parameters in a query string.

Resources