Problem solved, no need to touch the action attribute, just put the call in "onsubmit" and leave the action untouched.
Antoine On Wed, Oct 21, 2009 at 10:30 PM, Antoine van Wel <[email protected]> wrote: > Thanks, it works! > > In my case submitting the form is not natural at all - the form submit > does a lot of actions while all I want is the text that the user > entered to show up in the next page. (The link that is being clicked > is not directly related to the form.) > > Now I got a new question related to this... Instead of attaching this > behavior to a link, I want this behavior attached to a form submit. So > got 2 forms on the page, that event needs to get triggered on form > submit.. Guess I need to put the same hook in the "action" of the > form. But how to do that and afterwards continue with the original > action? (The headache is caused when pressing the enter key in that > second form.) > > > > Antoine > > On Wed, Oct 21, 2009 at 2:52 PM, Pedro Santos <[email protected]> wrote: >> Or can I let clicking the link generate an event which then will be picked >> up by the component >> >> you can, but is an workaround: >> 1 - add AjaxFormComponentUpdatingBehavior on your textarea for 'metal' event >> 2 - add >> eval(Wicket.$('mytextareamarkupid').getAttribute('metal')) >> on 'onclick' event of your link >> >> But... seems very natural require the user submit the form that contains the >> textarea. >> >> On Wed, Oct 21, 2009 at 10:18 AM, Antoine van Wel <[email protected] >>> wrote: >> >>> Thanks for the replies. >>> >>> Peter: that won't work - the contents of the textarea are not >>> transferred to the wicket app without some javascript / ajax magic >>> happening under the hood >>> >>> Pedro: Using that I could let the component listen to onchange event >>> but that would cause an unacceptable load. I really want the model >>> update action to be initiated by the link. Or can I let clicking the >>> link generate an event which then will be picked up by the component? >>> >>> >>> >>> >>> Antoine >>> >>> >>> On Wed, Oct 21, 2009 at 2:03 PM, Pedro Santos <[email protected]> wrote: >>> > you can add an AjaxFormComponentUpdatingBehavior on your textarea to keep >>> > the model updated >>> > >>> > On Wed, Oct 21, 2009 at 9:58 AM, Peter Arnulf Lustig <[email protected] >>> >wrote: >>> > >>> >> Have you tried assign a Model to the component which needs to be >>> updated? >>> >> >>> >> Model<String> model = new Model<String>(""); >>> >> ---> assign to the component of the form. >>> >> i.e. final TextField tf = new TextField("txt", model); >>> >> >>> >> in Link Execution >>> >> -> tf.setModel(mode); >>> >> >>> >> >>> >> >>> >> ----- Ursprüngliche Mail ---- >>> >> Von: Antoine van Wel <[email protected]> >>> >> An: [email protected] >>> >> Gesendet: Mittwoch, den 21. Oktober 2009, 13:22:01 Uhr >>> >> Betreff: how to update a form model when clicking a link >>> >> >>> >> On a page there's a form with a textarea. >>> >> Somewhere else on the page there is a wicket link, which is not inside >>> the >>> >> form. >>> >> The user types something in the textarea and then presses the link. >>> >> >>> >> Now what I'd like to achieve is when the code of the link is executed, >>> >> the model of the form is up-to-date - so what the user has typed, >>> >> should be inside the model. The form should not be submitted. >>> >> >>> >> >>> >> Any suggestions how this can be done - preferably without writing >>> >> Javascript? >>> >> >>> >> >>> >> >>> >> Thanks, >>> >> Antoine >>> >> >>> >> >>> >> -- >>> >> take your photos everywhere you go - https://www.memolio.com >>> >> follow us on Twitter - http://twitter.com/Memolio >>> >> >>> >> --------------------------------------------------------------------- >>> >> 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] >>> >> >>> >> >>> > >>> > >>> > -- >>> > Pedro Henrique Oliveira dos Santos >>> > >>> >>> >>> >>> -- >>> take your photos everywhere you go - https://www.memolio.com >>> follow us on Twitter - http://twitter.com/Memolio >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >>> >>> >> >> >> -- >> Pedro Henrique Oliveira dos Santos >> > > > > -- > take your photos everywhere you go - https://www.memolio.com > follow us on Twitter - http://twitter.com/Memolio > -- take your photos everywhere you go - https://www.memolio.com follow us on Twitter - http://twitter.com/Memolio --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
