Error message

  • Notice: Undefined index: jspies in drupal_theme_initialize() (line 100 of /home/iat/
  • Notice: Trying to get property of non-object in _drupal_theme_initialize() (line 146 of /home/iat/
  • Notice: Trying to get property of non-object in _theme_load_registry() (line 335 of /home/iat/
  • Notice: Undefined index: jspies in theme_get_setting() (line 1440 of /home/iat/

Textbox HTML Forms

Riskind's picture
Is current?: 

The text box template textbox.htm is a type of HTML form.  

Lines 25-29 display instructions. In this template, a question is followed by an open field known as a text box. Users type their responses in the text box and then click on the submit button. Text boxes are used when users retrieve information that cannot be displayed as options (e.g., nickname) or if research suggests that the data obtained is superior when participants type their answers in. The text box is created using the input tag as shown below.



    <td>What is your favorite thing about Charlottesville?<br/> 

        <input class="inputtext" type="text" maxlength="100" size="75" name="tbitem1"
          onkeypress="keyCode=(event.which)?event.which:event.keyCode;return (keyCode!=13);" />



</table> <br />

This table has one row with one data cell column. The question is followed by the <br/> tag, which creates a line break so that the text box appears on the next line. In the input tag used by the text box, the type="text" attribute specifies that this is a text box and the name is tbitem1. The styling of the text typed in is controlled by inputtext , which is listed on line 9.  No more than 100 characters can be typed in this field (maxlength) and the width of the text box is about 75 characters (size).  When any key is pressed during typing, the onkeypress event triggers Javascript code that has the effect of ignoring the Enter key (this has keyCode = 13).  This code is useful because it prevents accidental form submission that can be caused by pressing the Enter key on HTML forms.