Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
HTML
HTML
<s:form id="form" action="AjaxTest">
  <input type="textbox" name="data">
  <s:submit type="button" theme="ajax" label="Update Content"/>		
</s:form>
Warning
titleSubmit inside a form

If the submit tag is inside a form, the "onsubmit" event of the form will be canceled.

A submit button can be used to submit a form, even if it is outside the form, using "formId" and "formFilter" and "href". Note that in this case "href" is required.

...

Code Block
HTML
HTML
<div id="div1">Div 1</div>
<div id="div2">Div 2</div>

<s:url id="ajaxTest" value="/AjaxTest.action" />

<s:a theme="ajax" href="%{ajaxTest}" targets="dev1,dev2">Update divs</s:a>

If the anchor tag is used inside a form (href is not required on this case), the form will be submitted asynchronously:

Code Block
HTML
HTML

<s:form id="form" action="AjaxTest">
  <input type="textbox" name="data">
  <s:a theme="ajax">Submit form</s:a>		
</s:form>
Warning
titleSubmit inside a form

If the submit tag is inside a form, the "onsubmit" event of the form will be canceled.

Using the anchor tag to submit a form:

Code Block
HTML
HTML

<s:form id="form1">
  <input type="textbox" name="data">	
</s:form>

<s:url id="ajaxTest" value="/AjaxTest.action" />

<s:a theme="ajax" href="%{ajaxTest}" formId="form1">Submit form</s:a>

See the Div tag for examples on how to use "handler", "loadingText" and "errorText"

...