Let’s say i have a form to perform a login to another site. With the infrastructure we have here, it reads html from a database, build a page containing a form, plugging in real values for some placeholders and then uses javascript to submit the form.
For example:
<body>
<form method="POST" action="http://othersite/ssologin.php" name="ssoform">
<input type="hidden" name="user" value="@username" />
<input type="hidden" name="pass" value="@password" />
</form>
<script type="text/javascript">document.ssoform.submit();</script>
</body>
However, this is not XHTML compliant code. The ‘name’ attribute is deprecated and should be replaced by ‘id’. But in doing so, the javascript does not work anymore and the form doesn’t submit at all. It turns out that the javascript needs to be modified slightly:
<body>
<form method="POST" action="http://othersite/ssologin.php" id="ssoform">
<input type="hidden" name="user" value="@username" />
<input type="hidden" name="pass" value="@password" />
</form>
<script type="text/javascript">document.forms.ssoform.submit();</script>
</body>