Source

webwork / src / test / com / opensymphony / webwork / views / jsp / ui / Formtag-2b.txt

<form id="testAction" name="myForm" action="/testAction.action" method="POST" enctype="myEncType" onsubmit="return(myForm_validate())" >
<table class="wwFormTable">
<tr>
 <td align="right" valign="top"></td>
 <td><input type="text" name="foo" value="bar" id="testAction_foo" /></td>
</tr>
<tr>
 <td align="right" valign="top"></td>
 <td><input type="text" name="user.name" value="Bobby" id="testAction_user.name" /></td>
</tr>
</table>
</form>
<script type="text/javascript">
function myForm_validate() {
  var form = document.forms['myForm'];
  var focus = myForm_validate_actual();
  if (focus != null) { form.elements[focus].focus();
    if (form.elements[focus].type == 'text' || form.elements[focus].type == 'textarea') {
      form.elements[focus].select();
    }
    return false;
  } else {
    return true;
  }
}
function myForm_validate_actual() {
  var form = document.forms['myForm'];
  value = form.elements['foo'].value;
  if (value == "") {
    alert('Foo is required!');
    return 'foo';
  }
  value = form.elements['user.name'].value;
  if (value == "") {
    alert('Please enter a name!');
    return 'user.name';
  }
  return null;
}
</script>
<form id="testAction" name="myForm" action="/testAction.action" method="POST" enctype="myEncType" onsubmit="return(myForm_validate())" >
<table class="wwFormTable">
<tr>
 <td align="right" valign="top"></td>
 <td><input type="text" name="foo" value="bar" id="testAction_foo" /></td>
</tr>
<tr>
 <td align="right" valign="top"></td>
 <td><input type="text" name="user.name" value="Bobby" id="testAction_user.name" /></td>
</tr>
</table>
</form>
<script type="text/javascript">
function myForm_validate() {
  var form = document.forms['myForm'];
  var focus = myForm_validate_actual();
  if (focus != null) { form.elements[focus].focus();
    if (form.elements[focus].type == 'text' || form.elements[focus].type == 'textarea') {
      form.elements[focus].select();
    }
    return false;
  } else {
    return true;
  }
}
function myForm_validate_actual() {
  var form = document.forms['myForm'];
  value = form.elements['foo'].value;
  if (value == "") {
    alert('Foo is required!');
    return 'foo';
  }
  value = form.elements['user.name'].value;
  if (value == "") {
    alert('Please enter a name!');
    return 'user.name';
  }
  return null;
}
</script>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.