I can't figure out how to add the <form> tag - forms

I have a simple search box where the user is required to click the Submit button to send the address to some PHP/AJAX to query our SQL db. It does this by using the 'main-search' id of the Submit input.
<div class="address-search">
<input type='text' class='main-search-address' id="main-search-address" placeholder="Enter Street Address">in Seattle, WA
<input value="Search" type="submit" class="submit" id='main-search'>
</div>
I'd like to enable the user to be able to submit this form using the 'Enter' key, but when I wrap the inputs in a form tag, it submits, but no results show up. I've tried adding the id='main-search' to the form tag, which seems to get me closer, but instantly submits the form upon clicking in the text input.
Any help?
Thank you.

Try change:
<input value="Search" type="submit" class="submit" id='main-search'>
for:
<button type="submit" class="submit" id='main-search'> Search </button>
If nothing is displayed, you're probably wrong in your AJAX. Remember, AJAX needs a "id destiny".

Related

how to store the contact us form data in the google forms for my website

I would like to store the contact us form data in my google form. I have created contact us form in my webpage and copied the google form link in my form link. Kindly tell the steps to make the form work
Here the code that I have written
<div class="form-group">
<form action="https://docs.google.com/forms/d/e/1FAIpQLSedlnzPGGIwjq_C3W0KCev-WexWs6SFdf7nk0sWT3v2wP6fA/viewform?usp=sf_link" class="comment-form contact-form" novalidate="novalidate">
<input type="text" class="form-control" placeholder="Name" name="name">
<input type="text" class="form-control" placeholder="Mail Address" name="email">
<textarea name="message" class="form-control" placeholder="Comment"></textarea>
<button type="submit" class="contact-us thm-btn"><span>Post Now</span></button>
</form>
My google form link is placed n the action which is https://docs.google.com/forms/d/e/1FAIpQLSedlnzPGGIwjq_C3W0KCev-WexWs6SF-df7nk0sWT3v2wP6fA/viewform?usp=sf_link
The google form data is accessible via google sheets.
You also have the ability to create a trigger that will do something with the data when the form is posted, more information on this can be found at.
https://developers.google.com/gsuite/add-ons/concepts/editor-triggers

Submit web form button - Dreamweaver

I am trying to use Dreamweaver CC 2017.5 to update an existing website. I am stuck on a web form button that won't submit the information. There is both a Submit button (which does not work) and a Reset button (which does work). I have looked for a link to send the form to an email, but I haven't found it yet.
Here is the existing code, as extracted from the large form coding:
Comments:
<br>
<textarea rows="8" name="comments" cols="50"></textarea>
<p>
<input id="SUBMIT" name="Submit Form" type="SUBMIT" value="Submit">
<input type="RESET" value="Reset Form" name="RESET">
</td>
Can you help?
Those buttons won't work if you haven't set a form action. Here is a working example to help: https://www.w3schools.com/html/html_forms.asp

How do I get this Newletter Form to work?

I'm not sure what to put in for href:\ Should I reference a mailhandler.php or use a mailto: command? Or is there something better?
<h3 class="margin-bot">Newsletter!</h3>
<form id="subscribe-form" name="sibscribe" method="post">
<label><input class="subscribetext" type="text" onFocus="if(this.value =='Enter E-mail:' ) this.value=''" onBlur="if(this.value=='') this.value='Enter E-mail:'" value="Enter E-mail:" name="keyword" /></label>
<a onClick="document.getElementById('subscribe-form').submit()" class="button" href="#">subscribe</a>
</form>
I think it is meant for the site to which you get after pressing the subscribe button. Preferably the page the form was implemented in (for example to return to the index.html).
You can try it by testing it here on jsfiddle (http://jsfiddle.net). Just put an URL in the field where now is the # and after pressing subscribe you will see that you'll be redirected to that page.

reveal div after form submit

On my Wordpress website, I have an input field where the user types their email address and then clicks "Submit" to submit their email to my google spreadsheet (using a google form on Google Drive).
I also have a button that opens a popup when the button is clicked (I'm using the SimpModal plugin for Wordpress).
Is there a way to integrate both functions, so that I will only have 1 button that accomplishes both results? (i.e. When the user fills out their email address and then clicks the submit button, it will submit their email address to the google form, and also open the popup window?)
Here's my code:
<!--This gets rid of the google confirmation page-->
<script type="text/javascript">var submitted=false;</script>
<iframe name="hidden_iframe" id="hidden_iframe" style="display:none; width:0px; height:0px;" onload="if(submitted){window.location='#';}"></iframe>
<form action="https://docs.google.com/forms/d/XXXXX/formResponse" method="POST" id="ss-form" onsubmit="" target="hidden_iframe">
<input type="text" name="entry.2005577686" value="" id="entry_2005577686">
<input type="submit" name="submit" value="Submit" >
<div id="button-to-open-popup"><a href="#">
<img src="/landing-pg-button-black.png" alt="" /></a>
</div>
</form>
Thanks in advance!!!
Really simple! If you don't have jQuery, please import it somewhere in your code:
<script src="http://code.jquery.com/jquery-latest.js"></script>
And then change the onsubmit in the form tag...
<form ... onsubmit="$('#button-to-open-popup').click();return true;" ...>
Tada!

How to put 2 different Submit Buttons in a form (with CI)?

I have a form where I want the user to choose 2 different way to checkout :
Let say that the user enters his informations like his address, name and credit info.
Using Paypal Pro, at the end, I want him to be able to choose whether or not he wants to checkout through paypal or through direct payment ... that would lead to a second form.
By the way, with CodeIgnieter, when following a form with another one, I got the validation process of the second one that always run, I mean when I come from the first form to the second one, in the second form I will see my error messages appears, for each field even if the user didn't try to submit yet. Is there a way to avoid this bug ?
Thanks !
Edited: see end of the answer
You should do it as you would normally:
View:
<form method="post" action="mysite.com/submit">
<input type="text" name="name1">
<input type="text" name="name2">
<input type="text" name="name3">
<input type="submit" name="sbm" value="Direct">
<input type="submit" name="sbm" value="PayPal">
</form>
In PHP (controller probably):
if($this->input->post('sbm') == "PayPal") {
// do something with PayPal
} else {
// do something with direct payment
}
Edited: If you would like the caption of the button (visible text) to differ from the value, use <button> element instead of the <input type="submit">:
<button name="payment_type" value="paypal" type="submit">I want to pay with PayPal</button>
<button name="payment_type" value="direct" type="submit">Or should I go with Direct Payment?</button>
Use some conditions for applying the validation rules.
if(isPayPalPro())
{
$this->form_validation->set_rules(....);
}else
{
//validation credit card payment
}
use some condition instead of isPayPalPro().
An alternative i personally like more is to name every submit button differently, like so:
<form method="post" action="mysite.com/submit">
<input type="text" name="name1">
<input type="text" name="name2">
<input type="text" name="name3">
<input type="submit" name="direct" value="Direct">
<input type="submit" name="paypal" value="PayPal">
</form>
Then check which value was sent:
if($this->input->post('direct')){
//Direct button was pressed
}
if($this->input->post('paypal')){
//Paypal button was pressed
}