I havent tested yet, but it seems exactly what i looking for. A submit link AND a submit button for the same form. I guess it will work, if not i will keep asking you. Thanks very much for your help.


On 11/21/05, Christian Essl <[EMAIL PROTECTED]> wrote:
Sorry I just realized that the SubmitLink before had a bug (test, test,
test ;)).Enclosed is something which should work - at least for FireFox
and IE& it does. Please test it if you need it - at all.

Thanks,
Christian


On Mon, 21 Nov 2005 04:43:26 +0100, Christian Essl
<[EMAIL PROTECTED]> wrote:

> I don't know if I understand you right but enclosed is a component which
> behaves (and is) exactly like a Wicket Button but renders instead <a
> href="" which triggers
> the
> form submit.
>
> One of the SubmitLinks must be given the form in the constructor to
> register an AttributeModifier,  which sets the name attribute of the
> form.
>
> The usage is:
>
>          final MyModel mod = new MyModel();
>          Form f = new Form("linkForm", new CompoundPropertyModel(mod));
>          f.add(new TextField("value1"));
>          f.add(new SubmitLink("link1", f) {
>              protected void onSubmit() {
>                  System.out.println("Link1 was clicked, value1 is: "
>                          + mod.getValue1());
>              };
>          });
>          f.add(new SubmitLink("link2") {
>              protected void onSubmit() {
>                  System.out.println("Link2 was clicked, value1 is: "
>                          + mod.getValue1());
>              };
>          });
> html:
>
>      <form wicket:id="linkForm" >
>          <input wicket:id="value1" type="text" size="30"/>
>          <a wicket:id="link1">Press link1 to submit</a>
>          <a wicket:id="link2">Press link 2 to submit</a>
>          <input type="submit" value="Send"/>
>      </form>
>
> Hope that helps,
>
> Christian
>
> On Sun, 20 Nov 2005 21:28:54 -0300, Manuel Corrales
> <[EMAIL PROTECTED] > wrote:
>
>> Maybe i was not clear about my problem. What i need is that when i click
>> the
>> link get some info and redirect to other page. So far, the only way i
>> can
>> get the info is getting the model on the onSubmit method, but that
>> method i
>> use it for redirect to a diferent page.
>>
>> On 11/20/05, Johan Compagner < [EMAIL PROTECTED]> wrote:
>>>
>>> then you need to do an onClick on the button that submits the form.
>>> only at this time you can't know that that link was clicked (or you
>>> have
>>> to do that with a special hidden field and check that field in the
>>> Form.submit () method)
>>>
>>> johan
>>>
>>>
>>> On 11/20/05, Manuel Corrales < [EMAIL PROTECTED]> wrote:
>>> >
>>> > Hi, i have a page with a small form, a couple links and a button
>>> > (submit).
>>> > Now, when the button is pressed, i can get the model data, but i need
>>> > that when a link is clicked, get some data of the form.
>>> >
>>> > How can i achieve this?
>>> >
>>> > Thanks.
>>> >
>>>
>>>
>
>
>



--
Christian Essl


Reply via email to