This section explains the process that takes place when a client requests a form that is configured with the Form Fill policy as described in Section 6.5, Form Fill Policies.
Figure 6-9 Sample Login Form with JavaScript
When Access Gateway is configured with the default Form Fill policy, it adds the following function to the Login page received from the web server. The bold text indicates where JavaScript is called.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!--Generated by Apache Software Foundation (Xalan XSLTC)--> <html class="detail/detail"> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script type="text/JavaScript"> /*SET up global vars*/ //all the variable declaration <script type="text/JavaScript"> function dvdRegisterSelect() { } </script> <title>Login Page</title> </head> <body id="tpz_body" style="width:99%; "onload="tpzOnLoad('login.prompt.g'); window.status='login.prompt.g'; ContextMenu.setup({'showForms':true}); ContextMenu.attach('detail/detail', 'cwc_optionsMenu_detail')" onfocus="window.status='login.prompt.g'" > <script type="text/JavaScript"> var arReenable = new Array(); function enableAll() {return reenableControls(arReenable);} </script> <script type="text/JavaScript"> //all the variable declaration function verify( f, bSubmitToSelf ){ return verifyFields (bSubmitToSelf,"\n");} </script> <div> <a title="Login" class="tabSelected">Login</a> </div> <form name="topaz" id="topaz" method="post" action="detail.do" onsubmit="enableAll();return verify(this,true);"> <input type="hidden" name="focus" id="focus" value="var/user.id"> <input type="hidden" name="focusContents" id="focusContents" VALUE="testuser1" > <input type="hidden" name="focusId" id="focusId" VALUE="X2" > <input type="hidden" name="formname" id="formname" VALUE="login.prompt.g"> <input type="hidden" id="clientWidth" name="clientWidth" VALUE="1473" > <script type="text/javascript"> function printThisView(){tpzPrintDetail();} </script> <input type="text" id="X2" name="var/user.id" dvdVar="" onclick="handleOnClick(this,event);" VALUE="testuser1" scripttype="text"> <input type="password" id="X5" name="var/old.password" dvdVar="" onclick="handleOnClick(this, event);" " VALUE="novell081" > <input type="button" name="0" id="X8" ButtonID="0" title="Login Page" value="Login" onclick="tpzDrillTable('', 'Login', '0','listdetail')" > <input type="button" name="3" id="X9" ButtonID="3" title="Exit Login Page" value="Cancel" onclick="tpzDrillTable('', 'Cancel', '3','listdetail')" > </form> <script language="JavaScript"> <!-- function LAGSubmitForm() { document.forms[0].submit(); } LAGSubmitForm(); //--> </script> </body> </html>
In this code, the LAGSubmitForm() function calls the default submit action of the form, which uses a POST request to send the data to the web server. But the submit action for the sample login form requires a JavaScript function to be executed. This function submits the form data to the web server. However, because the JavaScript is not executed by the default Form Fill policy, posting of the form data fails:
row=&__x=&thread=0&event=0&transaction=0&type=detail&focus=var%2Fuser.id&focusContents=testuser1&focusId=X2&focusReadOnly=&start=&count=&more=&tablename=&window=&close=&_blankFields=&_uncheckedBoxes=&formchanged=&formname=login.prompt.g&_multiSelection=&_multiSelection_tableId=&clientWidth=1473&var%2Fuser.id=testuser1&var%2Fold.password=novell081&var%2FL.language=en&0=Login&3=Cancel
Meanwhile, the browser expects to receive the following POST request and does not autosubmit the form:
row=&__x=&thread=0&event=0&transaction=0&type=detail&focus=var%2Fuser.id&focusContents=testuser1&focusId=X2&focusReadOnly=null&start=&count=&more=&tablename=&window=&close=&_blankFields=&_uncheckedBoxes=&formchanged=&formname=login.prompt.g&_multiSelection=&_multiSelection_tableId=&clientWidth=1217&var%2Fuser.id=testuser1&var%2Fold.password=novell081&var%2FL.language=en
Note the difference in POST requests sent to the browser. The first POST request has &0=Login&3=Cancel appended, which results in login failure.
For the browser to send the proper POST data, Access Gateway must add the following JavaScript statement to the Statements to execute section:
tpzDrillTable('','Login','0','listdetail');