Javascript Login Button

Hi guys, I'm trying to make buttons for the login page to use for the demo projects. These buttons should automatically fill in the login forms and then submit these values. I, however, am having issues with the submitting bit. The code I currently have is as following: <form id="login" class="loginForm" method="post" action="index3.html"> <table cellpadding="0" cellspacing="0" class="loginTable"> <tr> <td colspan="2"><div id="result" class="loginResult"></div></td> </tr> <tr> <th><label for="username" class="formLabel">Name</label></th> <td><input id="username" type="textfield" name="username" class="formInput" /></td> </tr> <tr> <th><label for="password" class="formLabel">Password</label></th> <td><input id="password" type="password" name="password" class="formInput" /></td> </tr> <tr> <td colspan="2" class="loginButton" id="trigger"> <input id="submit" type="submit" value="Login" class="formButton" /> </td> </tr> <tr> <td> <a style="cursor:pointer;" onclick="document.getElementById('username').value='MxAdmin'; document.getElementById('password').value='1'; login.submit();">Login as MxAdmin</a> </td> </tr> </table> </form> This basically fills the Username with 'MxAdmin' and the Password with '1', but the submit function doesn't work. Does Mendix process these fields in a different way? In other words: what script is ran after submitting the username and password?
2 answers

When the form gets submitted, the form data is now posted to index3.html (action="index3.html"), which does not exist in a default configuration, or is a plain html file, extracted from a theme.

If you want to customize the login form, I suggest to either use a login widget from the App Store, or customize the default login.html. In the latter case, you might want to rename index.html to index3.html and login.html to index.html, so you don't have to navigate to /login.html by hand.


It's fixed. Changed the line with the script to:

< a style="cursor:pointer;" onclick="document.getElementById('username').value='MxAdmin'; document.getElementById('password').value='1'; document.getElementById('submit').click()">Login as MxAdmin

Special thanks to Michel Weststrate :)

This thread can now be closed.