Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can still set them serverside, ie if a login-form submit is received without username/password, then override it with your default user/pass and continue your login-script.</p> <p>Alternatively or on top of this, you could also set 1 or 2 extra hidden fields if you should wish to assign different default user/pass combinations dynamically.</p> <p>More directly to your question, you already figured out how to populate one field.. so a second field is repeating the same trick. You can still use the default submit-buton from the form if you'd like to, but then you need Javascript running on the client. Submitting the form is traditionally done by document.forms[n].submit();<br> Yet document.getElementById('submit').click(); works so much better..</p> <p>So all in all, for a graceful fallback, I'd advise 2 hidden form-fields and take care of the rest serverside.</p> <p>Good luck</p> <p><strong>UPDATE 3:</strong> Two versions based on my technique, now works perfectly!!!<br> Auto-logon:</p> <pre><code>&lt;form action="login.php" method="post" id="formID" name="formID"&gt; &lt;label for="name"&gt;Username:&lt;/label&gt; &lt;input id="name" name="name" type="text"&gt; &lt;label for="user_email"&gt;Password:&lt;/label&gt; &lt;input id="user_email" name="email" type="password" /&gt; &lt;input id="submit" name="submit" type="submit" value="Login" /&gt; &lt;/div&gt; &lt;/form&gt; &lt;script type="text/javascript"&gt; window.onload=function(){ document.getElementById('name').value = 'duddu'; document.getElementById('user_email').value = 'dudu'; document.getElementById('submit').click(); }; &lt;/script&gt; </code></pre> <p>Button (user initiated) auto-logon:</p> <pre><code>&lt;form action="login.php" method="post" id="formID" name="formID"&gt; &lt;label for="name"&gt;Username:&lt;/label&gt; &lt;input id="name" name="name" type="text"&gt; &lt;label for="user_email"&gt;Password:&lt;/label&gt; &lt;input id="user_email" name="email" type="password" /&gt; &lt;input id="submit" name="submit" type="submit" value="Login" /&gt; &lt;input name="free" type="button" value="Free User Login" onclick="popAndSub();" /&gt; &lt;/div&gt; &lt;/form&gt; &lt;script type="text/javascript"&gt; var popAndSub=function(){ document.getElementById('name').value = 'duddu'; document.getElementById('user_email').value = 'dudu'; document.getElementById('submit').click(); }; &lt;/script&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload