Fill login form from another page - html

I'm a HTML newbie and I'm completing a website where I'd put the login form to another website.
Basically I'd like to have two forms, one for the user and one for the password, of course, and a "fake" login buttom. Basically it'll switch to the real login page, fill the proper forms doing the real login.
Is it possible? Using Chrome I saw that the login page is something like this:
<form action="websitepath/home.xhtml" method="POST">
<input type="hidden" name="xwt.act" value="DO_LOGIN">
<table cellspacing="0" cellpadding="0" width="100%" class="m2">
<tbody>
<tr>
<td align="center" class="gray">
Username:
</td>
</tr>
<tr>
<td align="center">
<input type="text" size="15" id="username" name="xwt.usr">
</td>
</tr>
<tr>
<td align="center" class="gray">
Password:
</td>
</tr>
<tr>
<td align="center">
<input type="password" size="15" id="password" name="xwt.pwd">
</td>
</tr>
</tbody>
</table>
</form>

It's not possible to send the input directly into another form, but it should be possible (depending how the 2nd site handles login) to send the form directly from you to the original login form's action page.
Your form would should send the same inputs as the original form, and have the same action (websitepath/home.xhtml), with the full URL for the action.
Also - Autofill a form of another website and send it

You can post a form to another page quite easily with html+php
The basic gist of it is as follows:
Your Form On Site A
set the action to the target page and name your fields something logical
Site B
<?php
$variableOne = $_GET['fieldname'];
$variableTwo = $_GET['otherfieldname'];
?>
This is where it gets a little fuzzy on your intentions, you don't actually have to display another login page here, you can actually just push those values to your login script but if you absolutely want redundant login forms you can recreate the form on Site B and assign the field values to :
and it will grab the posted data for you again then you can drive your login form to whatever you normally do.
Hope this Helps

if you can't modify the other site then my above method wont work for you. Your only option would be to be create a form on Site A as follows
<form method="POST" action="http://remoteurl/websitepath/home.xhtml">
<input type="hidden" name="xwt.act" value="DO_LOGIN">
<input type="text" name="xwt.usr">
<input type="password" name="xwt.pwd">
</form>
This would in theory direct your login to the login script on the remote site.

Related

Table with multiple rows doesn't work with forms in HTML

Basically, I have a table with inputs inside a form tag, that are required by user to fill in.
When I test it, the form is working, but only when there is one row in a table. With two an more rows, a required attribute is not working.
I've written a simple example
This works, click enter inside input field to see.
<form>
<table>
<tr>
<td>
<input type="text" name="usrname" required>
</td>
</tr>
</table>
</form>
<br>
This doesn't work, click enter inside input field to see.
<form>
<table>
<tr>
<td>
<input type="text" name="usrname" required>
</td>
</tr>
<tr>
<td>
<input type="text" name="surname" required>
</td>
</tr>
</table>
</form>
That's because forms with more than one text input aren't submitted by hitting enter. Try adding a submit button to both forms and you'll see it works fine.
In your example, is that supposed to be two identical fields in the different cells (and one of them is just misspelled)? If so, that's likely your problem. If they are intended to be two separate fields, it should work, but I'd need to see a more real-world example.
Also, I'd highly recommend using CSS to format/style your form. If that sounds intimidating, try Bootstrap--it makes creating pretty forms extremely easy.

is there a way to save html form data with out web server or use of php?

This is an example of the code i have. there are multiple data fields that need saved and n seperate lines so the data is legible.
enter code here
<html>
<body>
<center>
<font size="2" face="arial" color="#CF18DC">
* Required Field</font></center>
<center><form enctype="multipart/form-data" method="post" action="" accept- charset="UTF-8">
<tr>
<td valign="top">
<center><strong><font color="#CF18DC">* </font>/Member #: </strong>
</td>
<td valign="top">
<input type="text" name="field-885d025b2e34341" id="field-885d025b2e34341" size="40" value="" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value=" Submit Form " />
</td>
</table>
</form>
</body>
</html>
i need a submit function or something to save the form data to a txt file in a local directory. I just cant figure this out can anyone please help? The file name that saves has to be the answer received in one of the collected data fields or it will just over write the file each time. Is this possible?
Not really. You will need some sort of contraption on the server side in order to write data to a source.
it does not have to be PHP. It can be any number of things; PHP, Python, Node.js, Ruby, etc.
You should easily be able to do this with some Javascript/Jquery. I'm not 100% sure this is what you're looking for, but I'm going on a hunch.
See htmlNewbie's question.
Hope this helps.

Password input field created with HTMLService loses type=password

I'm creating a password reset form for use by staff at a school using Google Apps for Education. I'm using the HTMLService API to import an html file and use it as a template. Part of that file is this table:
<table id=passwords>
<tr>
<td>New Password</td>
<td>
<input name='password1' id='password1' type='password'/>
</td>
</tr>
<tr>
<td>Confirm New Password</td>
<td>
<input name='password2' id='password2' type='password'/>
</td>
</tr>
</table>
When I display this as a gadget on a Google Sites page, the type='password' is lost from the html, so passwords aren't hidden when the user types them in:
<table id="passwords-caja-guest-0___">
<tbody><tr>
<td>New Password</td>
<td>
<input autocomplete="off" id="password1-caja-guest-0___" name="password1">
</td>
</tr>
<tr>
<td>Confirm New Password</td>
<td>
<input autocomplete="off" id="password2-caja-guest-0___" name="password2">
</td>
</tr>
</tbody></table>
I can shift to using UIService instead, which has a password input widget that does hide the password, but then the other folks that are going to maintain the site after me will also have to learn UIService's rather lengthy API.
So, I'm looking for ideas on how to hide the password input in this context (i.e. just show asterisks or bullets when the user types in a password).
Congratulations! You have filed the very first bug on the new HtmlService :).
It seems that type=password is lost on the sanitization step. It's filed as bug 1487
As a workaround, this will work fine today.
<input name='password1' id='password1' />
<script>document.getElementById('password1').type='password'</script>
That is, setting the type yourself in JavaScript is working. This is only a temporary workaround though; we will fix the underlying bug asap. Thanks for the report.
Update: The underlying bug has been fixed in Caja and we will pick it up in the next Apps Script release.

why is password field showing masked value when html form is loaded?(only in firefox)

the password field in the html form i have created for my webpage is displayed some masked value which i believe is the password value that im using to connect to my database(same number of characters). But the problem is only for firefox: ie and chrome is displaying correctly.
ive also tried setting the password value to null (""), it didnt help either.
The variable name for sql password, post etc are different.
this is the code...
<div id="logincont">
<div id="loginfrm">
<form name="loginform" method="post" action="index.php">
<table class="logintable">
<tr>
<td width="70px"><span class="fonts"> Username</span></td><td><input type="text" name="user" id="userfield" /></td>
</tr>
<tr>
<td width="70px"><span class="fonts"> Password</span></td><td><input type="password" name="pass" id="passfield" /></td>
</tr>
<tr>
<td></td><td><input type="submit" name="submit" value="Submit" />
</td></tr></table>
</form>
</div>
</div>
n even after clearing the cache n cookies too, its showing the same thing..
To remove saved passwords in FireFox, go to Tools -> Options, Security tab, click the Saved Passwords button, and remove the saved passwords that you want removed. Also, if you have browser toolbars or add-ons, some of them may save passwords and auto-fill them into forms. I think that the Google Toolbar does this as well, so you may need to look at the security options for that, in addition to the FireFox options.

How does the input tags really work?

I read several articles, but couldn't really get things working. Here's what I'm talking about. The Html of a webpage:
<form id="LOGINFORM" name="LOGINFORM" style="margin:0px; padding:0px;" action="login.php" method="post">
<table cellspacing="2" cellpadding="0" border="0" width="100%">
<tr>
<td width="100" align="center" valign="bottom">
Username:
</td>
<td width="100" align="center" valign="bottom">
Pass:
</td>
<td valign="top" align="right">
</td>
</tr>
<tr>
<td align="center">
<input class="inputbox" style="text-align:center; width:90px;" maxlength="12" name="loginname" type="text" size="12">
</td>
<td align="center">
<input class="inputbox" style="text-align:center; width:90px;" maxlength="12" name="password" type="password" size="12">
</td>
<td align="left">
<input
class="button_ok"
name="btnSubmit"
id="btnSubmit"
type="submit"
value="Вход"
onclick=""
>
</td>
</tr>
</table>
</form>
say the webpage is helloworld.com, account is foo, pass is bar.
What I browse: helloworld.com/login.php?loginname=foo&password=bar
But server returns that username/password is wrong, but they aren't. What do I do wrong?
The logic in login.php says that loginname=foo&password=bar is wrong. That is where you need to look to find out why it doesn't work.
As for what is wrong with the HTML.
You are using a table for layout
You aren't using <label> elements to label your inputs
You having given a form a name, these days an id is all that is required (and then only if you need to reference it with JS or CSS)
You are using a style attribute instead of a seperate stylesheet, and quite a few obsolete presentational attributes (such as align, width and cellspacing)
that form secifies that the data is passed via POSt, and not GET as you are trying to pass it. If a form wants data back specifically as POST data, that page will ignore GET data. see this tutorial
Your HTML says method="post", so I guess the server will only accept those values by the POST method. When you browse that URL, you are sending them using the GET method.
You are confusing GET and POST in PHP:
$_GET['loginname'] will retrieve a query string variable.
$_POST['loginname'] will retrieve the value of the input named "loginname". (This is what you need.)
helloworld.com/login.php?loginname=foo&password=bar uses GET