This command is used to define the fields in the form for entering the name and other information of the exam taker. The option “text” is optional and is used to include a short text before the field to give, for instance, instructions on how to fill it. The option “requirefield” is also optional and it is used to make the field required and give a javascript alert if the submit button is pressed without having filled this field.
inifield ( name="email" label="EMAIL: " type="text" size="20" text="Please enter your email:" requirefield="You have to enter your email")
will introduce the following lines in your latex source:
Please enter your email: %%tth:\begin{html} <P>\end{html} %%tth:\begin{html} <LABEL for="email">EMAIL: </LABEL>\end{html} %%tth:\begin{html} <INPUT type="text" name="email" size=10><BR>\end{html}
and a script to make the field required:
%%tth:\begin{html} <script type="text/javascript"> \end{html}%%tth:\begin{html} window.onload=function(){var elForm=document.getElementsByTagName('form')[0]; elForm.onsubmit=function() { var required=['email']; var textreq=['You have to enter your email']; var bool=true; for(var i=0;i<required.length;i++) { if(document.getElementsByName(required[i])[0].value=='') { alert(textreq[i]); bool=false; } } return bool; } } \end{html} %%tth:\begin{html} </script> \end{html}