You can also use a page-specific validation delegate to do this.
Assuming you already have a custom delegate
called "AppValidationDelegate", you would do something like this inside
your page class:
// Page-specific validation delegate class.
public static class PageValidationDelegate extends
AppValidationDelegate {
@Override
public String getFocusField() {
if ( !getHasErrors() ) {
return "custRefField";
}
return super.getFocusField();
}
}
@Bean(PageValidationDelegate.class)
public abstract IValidationDelegate getValidationDelegate();
In this example, custRefField will get focus by default. However, the
normal Tapestry behavior of setting focus on the first field with an
error will still work.
-Ryan
Chris Chiappone wrote:
set the focus attribute to true or false for your component.
On 3/9/06, Jesse Kuhnert <[EMAIL PROTECTED]> wrote:
There is a Forms.js package that should be loaded by default when using
tapestry forms. If you add something like this at the very bottom of your
page it might work:
<script>
Tapestry.set_focus(yourFieldId);
</script>
Where yourFieldId = the value of <input id="yourFIeldId" />
On 3/9/06, Claus Weng <[EMAIL PROTECTED]> wrote:
Hi,
Is it possible to control exactly what field that should have focus when
loading the page?
In this case Tapestry puts focus on my submit button, but I want focus
on the custRefField.
How can I tell Tapestry that I want focus on that field?
<form jwcid="form" name="form" method="POST" action="Browse.html">
<input jwcid="saveBtn" title="Save [Alt+S]" accesskey="S"
class="button" type="submit" value=" Save "/>
<input jwcid="custRefField" size="35" tabindex="1" type="text"/>
</form>
Best Regards
Claus Weng
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
~chris
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]