You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by TH Lim <ss...@gmail.com> on 2009/02/27 20:31:26 UTC

Multiple Forms in A Border

I am using Wicket-1.4-SNAPSHOT libraries. I have a  page with multiple forms.
These forms are within a Border as shown in the HTML below

<html>
<body>
   <div wicket:id="border">
       <form wicket:id="form1">
           <input wicket:id="quantity1" /><br/>
           <input type="submit" value="Quantity1" />
       </form><br/>
       <form wicket:id="form2">
           <input wicket:id="quantity2" /><br/>
           <input type="submit" value="Quantity2" />
       </form><br/>
   </div>
</body>
</html>

The Wicket code to this page is

public class CommonModelPage extends WebPage
{
    private static final long serialVersionUID = 1L;

    int quantity1;
    int quantity2;

    public CommonModelPage()
    {
        CommonBorder border = new CommonBorder("border");
        add(border);

        Form form1 = new Form("form1");
        border.add(form1);

        form1.add(new TextField("quantity1", new PropertyModel(this,
"quantity1")));

        Form form2 = new Form("form2");
        border.add(form2);

        form2.add(new TextField("quantity2", new PropertyModel(this,
"quantity2")));
    }

    public int getQuantity1()
    {
        return quantity1;
    }

    public void setQuantity1(int quantity1)
    {
        this.quantity1 = quantity1;
    }

    public int getQuantity2()
    {
        return quantity2;
    }

    public void setQuantity2(int quantity2)
    {
        this.quantity2 = quantity2;
    }
}

CommonBorder is an empty border class with no Wicket components and simple
HTML texts. The problem was when I submitted form1 or form2 I get this
exception

WicketMessage: Can't convert null value to a primitive class: int for
setting it on [Page class = CommonModelPage, id = 10, version = 0]


I found 2 unlikely way to circumvent this exception: -
1. Do not use Border. 
2. Change quantity1 and quantity2 type from int to Integer.

My question is why does this happen? Ain't form1 and form2 are independent?
Do I need to change anything to Border to make this work?

Thanks

/lim/



-- 
View this message in context: http://www.nabble.com/Multiple-Forms-in-A-Border-tp22252817p22252817.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Multiple Forms in A Border

Posted by Igor Vaynberg <ig...@gmail.com>.
file a jira bug with a quickstart please.

-igor

On Sun, Mar 1, 2009 at 6:34 AM, TH Lim <ss...@gmail.com> wrote:
>
> I found out that this exception only happened to Wicket-1.4. I tried Wicket
> 1.3.5 and it worked fine. I presume all Wicket 1.3.x works too.
> --
> View this message in context: http://www.nabble.com/Multiple-Forms-in-A-Border-tp22252817p22273577.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Multiple Forms in A Border

Posted by TH Lim <ss...@gmail.com>.
I found out that this exception only happened to Wicket-1.4. I tried Wicket
1.3.5 and it worked fine. I presume all Wicket 1.3.x works too.
-- 
View this message in context: http://www.nabble.com/Multiple-Forms-in-A-Border-tp22252817p22273577.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org