I made a html form and want it to email the results to me, so I can evaluate the answer and later add it to my website. i want the email to somewhat look like this:
name: name
email: EMAIL
title: title
messige: massige
current program:
<!DOCTYPE html>
<html>
</body>
<form>
name<br>
<input type="text" name="name" id="user_input"><br>
email<br>
<input type="email" name="email" id="user_input"><br>
title<br>
<input type="text" name="title" id="user_input"><br>
message<br>
<textarea id="msg" name="user_message"></textarea>
</form>
<div class="button">
<button type="submit">submit</button>
</div>
</body>
</html>
If you don't want to use PHP/ Node.js/another technology, you can use the Formspree API. Your html would look like this:
<form action="https://formspree.io/your#email.com" method="POST">
<input type="text" name="name">
<input type="email" name="_replyto">
<input type="submit" value="Send">
</form>
And you sign up for an account here: https://formspree.io/ . You will receive form submissions in your inbox.
Another alternative is to add a "mailto" link instead of the full contact form. This creates a link that opens the user's default email system (ie gmail/outlook/mail) and lets them email you from their inbox. The "%0D%0A%0D%0A" part creates a new line in the email:
<a href="mailto:YOUREMAIL#gmail.com?subject=Hello&body=Hello Owen,%0D%0A%0D%0AI'm interested in xyz thing on your website%0D%0A%0D%0A" target="_blank">
Related
I wanted to try and verify input before being submitted therefore I used the required attribute at the end of input, but it's not working and I've already tried some of the recommended solution like wrapping the input in form tag or trying to close the tag of input () but when i submit my form with an empty input it stills submited normally and doesn't declare a required field .
I would appreciate any help, thank you!!
this is a part of my code
<form id="form" style="background-color:honeydew ;" class="container text-center">
<div><br><h2> Contact Us </h2></div>
<div id="contact">
<div>
<label> Name</label>
<input type="text" placeholder="Your name " name="name" required/>
</div>
<br>
<div>
<label> Email</label>
<input type="email" placeholder="name#gmail.com" name="email" name="email">
</div>
<br>
<div>
<label> Message</label>
<input type="text" style="height:50px;" name="message">
</div>
<br>
<div><input type="button" value="submit" name="submit"><br></div>
<br>
</div>
<br>
</form>
and this is the javascript file linked to it :
//we take informations subbmitted by user from the form and we replace the form with a reply
//containing these pieces of information on the click on the submit button
var form=document.getElementById('form'),
contactForm=document.getElementById('contact'),
submitButton=contactForm.children[6].children[0];
var processForm= function(){
name=document.getElementsByName('name')[0].value,
email=document.getElementsByName('email')[0].value,
sitereplyText=document.createTextNode('this is a initialiazing value'),
sitereplyEl=document.createElement('p');
mytext= 'Hey '+name+'! Thanks for your message :) We will email you back at '+email;
sitereplyText.nodeValue=mytext;
sitereplyEl.appendChild(sitereplyText);
form.replaceChild(sitereplyEl,contactForm);
}
submitButton.addEventListener('click',processForm);
So i firstly corrected the input type into submit
<input type="submit" value="submit" name="submit">
then in the javascript file i changed
submitButton.addEventListener('click',processForm);
to
submitButton.addEventListener('form.submit()',processForm);
and it seems to work :)
I'm unable to submit the form
I've checked my code thoroughly for hours and looked at posts on freecodecamp forums but it seems to me I still cannot submit the form and I can't pinpoint the problem.
<form action="https://www.freecodecamp.org/email-submit" id="form">
<div class="email-box">
<label for="email">Email: </label>
<input type="email" id="email" name="email" placeholder="Enter your email here.." required>
</div>
<div id="submit-box">
<input type="submit" id="submit" name="submit">
</div>
</form>
When I click the #submit element, the email is submitted to a static page (use this mock URL: https://www.freecodecamp.com/email-submit) that confirms the email address was entered (and that it posted successfully)
The error states:
AssertionError: The #email input should have a name attribute : expected false to equal true
So, add name attribute:
<input type="email" placeholder="Enter email address"id="email" name="email" required><br>
For any help check here.
I have a contact form at codepen.io, but it is not working. I don't know where I must put the email address that messages will be sent to.
<form class="cf">
<div class="half left cf">
<input type="text" id="input-name" placeholder="Name">
<input type="email" id="input-email" placeholder="Email address">
<input type="text" id="input-subject" placeholder="Subject">
</div>
<div class="half right cf">
<textarea name="message" type="text" id="input-message" placeholder="Message"></textarea>
</div>
<input type="submit" value="Submit" id="input-submit">
</form>
Thanks in advance for any help.
If you just want a really basic form to send an email, you can set the form action to "mailto:user#email.com". This will open the users default mail client and populate the subject and body with the contents of inputs named "subject" and "body" in the form. The form itself won't send email though - you would need PHP for that.
I have a problem with a form. It is not sending any action (page not even refreshing on click). If I copy the form in another document locally it has no problem, all working well, mail message being sent. Here is the code of the form:
<form method='post' name='ContactForm' id='contactForm' action='contact_main.php'>
<p>Your name:</p>
<input type="text" class="input-box" name="user-name" placeholder="Please enter your name.">
<p>Email address:</p>
<input type="text" class="input-box" name="user-email" placeholder="Please enter your email address.">
<p>Subject:</p>
<input type="text" class="input-box" name="user-subject" placeholder="Purpose of this message.">
<p class="right-message-box">Message:</p>
<textarea class="input-box right-message-box message-box" name="user-message" placeholder="Your message."></textarea>
<button type='submit' class='myinputbtn' name='submitf' id="submitf">Send your message</button>
<div id='message_post'></div>
<input type="hidden" name="contact">
</form>
Clicking the submit button results in... nothing!
Please let me know if I need to edit my question before downrating. Thanks!
Use
<input type="submit" ...
instead of a button (which is used with Javascript, not for form submitting)
I bought HTML landing page theme from themeforest. The theme has opt in e-mail form. Now i want to intergrate it with getresponse - so it would work like regular getresponse web form. How can I do it?
HTML theme code is:
<form method="post" action="[[ PUT_THE_URL_YOUR_FORM_POSTS_TO_HERE ]]">
<input type="email" placeholder="Enter your e-mail" name="email" id="email">
<input type="submit" name="submit" id="submit" value="Sign Up"/>
</form>
In your GetResponse account you should go to webforms menu, choose "Create a new webform" and head on to "Plain html" tab.
There you'll see some code like the one below — which has all you need:
<form action="https://app.getresponse.com/add_subscriber.html" accept-charset="utf-8" method="post">
<!-- Email field (required) -->
email: <input type="text" name="email"/><br/>
<!-- Campaign token -->
<!-- Get the token at: https://app.getresponse.com/campaign_list.html -->
<input type="hidden" name="campaign_token" value="CAMPAIGN_ID" />
<!-- Subscriber button -->
<input type="submit" value="Subscribe"/>
</form>
Don't forget that besides action="https://app.getresponse.com/add_subscriber.html" you do need to specify the campaign's id with <input type="hidden" name="campaign_token" value="CAMPAIGN_ID" /> inside the form code.