I would like to create a .html file with a link to gmail.com. When clicking the link, I would like to have my email address automatically filled in as the undermake. I would like to use JavaScript for this. That is, I would like to insert text from a JavaScript variable.
I noticed on the source code for the login page for Gmail that there is the following:
<label for="Email"><strong class="email-label">Username</strong></label>
<input type="email" spellcheck="false"
name="Email" id="Email" value=""
>
So, I guess that, my question is : how can I give a value to Email in this form on the gmail login page?
It looks like you can specify an email address in the URL for gmail:
https://accounts.google.com/ServiceLoginAuth?Email=email#example.com
Related
I'm making this form that, for now, redirects, a user to another page after submitting a form. However, after the user is redirected, the form fields pop up in the url. I'm a beginner and I was wondering on how I can keep the url path to just what I specified in the "action" attribute of the form. Here's my code
<div>
<form action="/test">
<input type="text" name="login-username" id="login-username" placeholder="Username" />
<input type="password" name="login-password" id="login-password" placeholder="Password" />
<input type="submit" name="login-submit-button" id="login-submit-button" />
</form>
</div>
After clicking the button, the url looks like this:
http://localhost:3000/test?login-username=&login-password=&login-submit-button=Submit
How can I keep it to just
http://localhost:3000/test
As mentioned clearly in this answer, default method of form on submit is GET with encoding of type x-www-form-urlencoded, which basically appends input data to the current URL.
Using method POST appends form-data inside the body of the HTTP request (data is not shown in URL).
Please can someone help me with how to create an input field that would take text, pictures, gif, attachment etc. just like Facebook/twitter/Quora's "Create Post" input field... it would be good to see a plugin that can help with that or if I can create it myself! thanks in advance... I know what you are about to say, I did my research and I couldn't find anything that help me with building. I just want something like a 101 of such palette so that I can continue build it... I will also like to add my own conventions (like Ctrl + B to bold etc.)
Take a look at this.
"post" Sends the form-data as an HTTP post transaction. The HTML action attribute is used to specify where the form data is to be sent to the server after submission of the form. It can be used in the element.
URL: It is used to specify the URL of the document where the data to be sent after the submission of the form.
All you need now is to specify a textarea where that post will be sent and style the button to say "Post" instead of the regular "Submit".
<form action="/action_page.php" method="post">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><be>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><be>
<input type="submit" value="Submit">
</form>
I need to know if its possible to send email (in c#) with html content of a text box and <a> tag.
<a> tag will have a redirect address.
Clicking the <a> tag should take the data from text box and pass it as an argument.
The main problem is I am not able to get the value of the text box, because Java Script is not allowed in the mail content.
Anybody has any thoughts or views about this?
This should not be possible because an email cannot process user events. You can only reply to email, you need a landing page or something else that the user can interact on.
I was able to solve my problem with form without using java script.
<form id='RejectFeedbackForm' method='get' action="http://localhost:49309/Controller/Action">
Reason for rejection<br />
<input type='text' name='comment' id='comment' /><br />
<input type='submit' value='Submit'>
</form>
In many sites, I have seen after clicking on "Sign Up" or "Register" button we are either re-directed to other page where the insertion of our data in database takes place. Like in Facebook, when you click "Sign Up" it goes to the facebook.com/r.php page. I want to create a registration form which when submitted, will be not re-directed but will validate and insert data in database in the same page.
For example, Facebook uses a form such as:
<form id="xyZ" name="abc" method="post" action="r.php">
It redirects us from index.php to r.php.
But I want to use:
<form id="xyZ" name="abc" method="post" action="index.php">
i.e Without redirecting.
Which one is safe?
Redirecting does not effect the security of the website at all in the slightest. I recommend taking a look here about possible authentication solutions you can use for your site.
Whether you authenticate and log them in/register them using index.php or r.php, it doesn't matter in the slightest. Forum systems such as phpbb used to at one time to everything in the index.php file, and depending on the ?page $_GET variable, it would display different things (Like a login form, or a registration form). How you handle it, is entirely up to you, but neither method is more insecure than the others.
Both are safe!
Redirect method, kind of link using which user redirects to another page where they can register
Ajax Method, here you can make calls using Javascript / jQuery which returns you html source, which you can just plug in appropriate place.
Your Page where you need your registration form to be displayed, when user click on sign up link
<div id="ajax-response"></div>
<a id="signup" href="signup.php">SignUp</a>
<script type="text/javascript">
jQuery("#signup").on('click', function(e){
e.preventDefault();
var _context = this;
jQuery.ajax({
url: jQuery(_context).attr('href'),
success: function(response){
jQuery("#ajax-response").html(response);
}
})
})
</script>
and signup.php, will contain the registration form
<form>
<input type="text" name="fname">
<input type="text" name="lname">
<input type="text" name="email">
<input type="submit" />
</form>
I want to send my data form that user type to a specific email. Example:
<form>
<input type="text" placeholder="Your name"/>
<input type="email" placeholder="Your email"/>
<textarea name="content"></textarea>
<input type="button" onclick="sendmail()"/>
</form>
When user clicks the button, an email will be sent to a specific address like admin#admin.com with email's content is what user type in the form. Can we reach that result with only JavaScript or jQuery?
You can't do it without additional modules :
This is a good tutorial , you could create a dedicated address reported#yoursite.com and have it email your admin address when a user registers
<a id="emailLnk" >send mail</a>
<script type="text/javascript">
$(document).ready(function() {
$("#emailLnk").click(function(){
document.location.href = "mailto:xyz#something.com";
});
});
</script>
No, unless someone took the time to rewrite a SMTP client or sendmail in JavaScript, which is not the case. Moreover, that would mean giving away the SMTP password (which is bad) or not using a SMTP at all, meaning that almost all free/commercial providers will reject your e-mail.
You should set up a minimal PHP script to receive a POST request and forward the body as e-mail to your designed account. You should be able to do it in a handful of lines.