/**
* De AJAX handler voor dit veld. Er wordt gebruik gemaakt van de Dojo
* handler.
*/
private final class FinanAjaxHandler extends DojoAjaxHandler {
/**
* Constructor.
*/
public FinanAjaxHandler() {
}
/**
* Let this handler print out the needed header contributions.
*
* @param container
* the header container
*/
protected void renderHeadInitContribution(HtmlHeaderContainer container) {
super.renderHeadInitContribution(container);
// add our basic _javascript_ needs to the header
Application application = Application.get();
addJsReference(container, new PackageResourceReference(application,
AutoUpdateTextField.class, "AutoUpdateTextField.js"));
}
/**
* @see wicket.AjaxHandler#renderHeadContribution(wicket.markup.html.HtmlHeaderContainer)
*/
public final void renderHeadContribution(HtmlHeaderContainer container) {
}
/**
* Attaches the event handler for the given component to the given tag.
*
* @param tag
* The tag to attach
*/
public final void onComponentTag(final ComponentTag tag) {
final ValueMap attributes = tag.getAttributes();
final String attributeValue = "_javascript_:validate('"
+ getCallbackUrl() + "', '" + getInputName() + "', this);";
attributes.put("onchange", attributeValue);
}
/**
* Gets the resource to render to the requester.
*
* @return the resource to render to the requester
*/
protected final IResourceStream getResponse() {
StringBufferResourceStream stream = new StringBufferResourceStream();
// validate the value of the model
validate();
if (isValid()) {
// update the model when valid, and notify the enclosing component of the success
updateModel();
onSuccess(stream);
} else {
// notify the enclosing component about the error
onError(stream);
}
return stream;
}
}
On 10/11/05, Scott Sauyet <[EMAIL PROTECTED]> wrote:
Thanks. I'll check it out.
-- Scott
Martijn Dashorst wrote:
> I have done so using the DOJOHandler, I suspect it won't cost too much
> effort to do so using the
> scriptaculous handler.
>
> Check the DojoValidationRequestHandler on how to perform such a feat,
> and replace the code in
> the onRenderRequest method to suit your needs.
>
> Martijn
>
> On 10/11/05, *Scott Sauyet* < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
> wrote:
>
> I know that people are furiously working on AJAX tools for Wicket, and I
> know there is some experimentatl stuff in the latest releases, but I'm
> wondering if there is something ready for what I think is a fairly
> simple need:
>
> I would like to update a session variable from a _javascript_ function.
> By the client's request, certain of the navigation is done with
> (unobtrusive, I'm glad to say) _javascript_. Basically there are tabs on
> certain pages which are switched via some simple JS. But now the client
> would like the tab choice to be sticky across the session. I do store
> this when the user submits the form on the page, but there are other
> links besides the form submit buttons, and when those are clicked, of
> course, tab choice changes are lost.
>
> I was hoping to find a simple way in Wicket to submit a request that
> does not return much of anything, just processes data submitted by JS
> and updates the Session.
>
> Is there an easy way to do this?
>
> Thanks,
>
> -- Scott
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads,
> discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> <mailto:Wicket-user@lists.sourceforge.net>
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
AutoUpdateTextField.js
Description: JavaScript source