hey igor thanks for all the help I really am learning a lot here.

I am having an issue forwarding the model tp my textfiled in my panel and I
wanted to show you my code and see what you thought the issue is. I am sure
it is something simple I have overlooked.

Template.java
public class Template extends WebPage {
private String teststring;
Form form = new Form("myform") {
        protected void onSubmit() {
                callDatabase(teststring);//this is always coming back null and 
I am not
sure why.
        };
};
form.setMarkupId("myform");
form.setOutputMarkupId(true);
add(form);
form.add(new FeedbackPanel("feedback"));
form.add(new TextFieldPanel("textfield", new PropertyModel(this,
"teststring")));
}


Template.html
<body>
        <form wicket:id="myform">
          all feedback messages go here!
          TextFieldPanel go here
    </form>
</body>

TextFieldPanel.java

public TextFieldPanel(String id, PropertyModel pm) {
          super(id, pm);
          add(new RequiredTextField("textField1", pm));
}


TextFieldPanel.html
<wicket:panel>
<input wicket:id="textField1" type="text"/>
</wicket:panel>


Now I was thinking that since I sent the PropertyModel to the TextFieldPanel
it should work but it did not. Is there an inheritance that i need to do to
get this to work? The goal here is to create a bunch of textFields on the
fly but first I would like to get this working so I know what I am doing
hince the simple example of my code.

Thanks again for the help

T


igor.vaynberg wrote:
> 
> no, it wont change, just have the panel forward the model to the
> textfield.
> 
> -igor
> 
> 
> On Wed, Feb 27, 2008 at 1:50 PM, taygolf <[EMAIL PROTECTED]> wrote:
>>
>>  Thanks igor I really appreciate the help. My code was really close but I
>> was
>>  not creating:
>>
>> private object selection1;
>>   private object selection2;
>>
>>  which was giving me my issues of getting the object in the onSubmit
>>  override. I do not know why I did not see something that simple I think
>> I
>>  was just blocked.
>>
>>  Will the code change at all if the textfield on page 2 is created in
>> nested
>>  panels. Since I am creating my form on the fly the textfield will be in
>> a
>>  panel nested in a panel. I might be able to change my code to allow just
>> one
>>  panel but I am not sure yet.
>>
>>  Thanks again
>>
>>  T
>>
>>
>>
>>  igor.vaynberg wrote:
>>  >
>>  > class page1 {
>>  >   private object selection1;
>>  >   private object selection2;
>>  >
>>  >   public page1() {
>>  >       form form=new form("form") {
>>  >          onsubmit() { setresponsepage(new
>> page2(selection1,selection2)); }
>>  >       }
>>  >       form.add(new dropdownchoice("s1", new propertymodel(this,
>>  > "selection1"), ...));
>>  >       form.add(new dropdownchoice("s2", new propertymodel(this,
>>  > "selection2"), ...));
>>  >   }
>>  > }
>>  >
>>  > class page2 {
>>  >    private final object selection1;
>>  >    private final object selection2;
>>  >    private final String text;
>>  >
>>  >    public page2(object selection1, object selection2) {
>>  >       this.selection1=selection1; this.selection2=selection2;
>>  >       form=new form("form") {
>>  >           onsubmit() {
>>  >               sendemails(selection1,selection2,text);
>>  >               savetodb(selection1,selection2,text);
>>  >                setresponsepage(donepage.class);
>>  >            }
>>  >        }
>>  >        form.add(new textfield("tf", new propertymodel(this,"text")));
>>  >      }
>>  > }
>>  >
>>  > -igor
>>  >
>>  > On Wed, Feb 27, 2008 at 11:16 AM, taygolf <[EMAIL PROTECTED]>
>>  > wrote:
>>  >>
>>  >>  yes all of my experiance is in JSP so I guess I am just confused
>> about
>>  >> how
>>  >>  forms work in wicket compared to JSP.  Maybe you can help me
>> understand
>>  >> and
>>  >>  suggest a way to accomplish what I am looking to do.
>>  >>
>>  >>  I have a form that takes in 2 dropdown chioces. When selected these
>>  >>  dropdownchoices are set to session variables. I then set the
>> response
>>  >> page
>>  >>  to a new page with a form. that form is created off of a query based
>> on
>>  >> what
>>  >>  was selected in the 2 dropdown choices. I have all of this working
>>  >> today.
>>  >>
>>  >>  Now when the form is filled out I want to save the information to
>> the
>>  >>  database, make a few other calls to push the data to outside
>>  >> applications
>>  >>  and databases and send emails and things like that. Then I simply
>> want
>>  >> to
>>  >>  display that the form was submitted properly.
>>  >>
>>  >>  There is no need to see the form once it is submitted so that is why
>> I
>>  >> want
>>  >>  to push it to another page but if I can override onSubmit to insert
>> the
>>  >> data
>>  >>  in the database then all I would have to do is set the response page
>> to
>>  >> a
>>  >>  simple html page that said your work is done or something like that.
>>  >>
>>  >>  I guess that would work perfect.
>>  >>
>>  >>  The one question I still have is how can I get the fileds from the
>> panel
>>  >> in
>>  >>  the onsubmit call? say my panel has a textfield in it and I set the
>>  >> markupId
>>  >>  to "test". how can I get that in the onsubmit call so I can create
>> my
>>  >> new
>>  >>  record in the database?
>>  >>
>>  >>  I am sorry that i have so many questions. I am very new to wicket.
>> only
>>  >>  about 2 weeks worth of looking at it and I think I have made a lot
>> of
>>  >>  strides going from knowing nothing to what I have so far. a little
>> more
>>  >>  knowledge and I will be set.
>>  >>
>>  >>  Thanks
>>  >>
>>  >>  T
>>  >>
>>  >>  SO you are saying that
>>  >>
>>  >>
>>  >>
>>  >>  igor.vaynberg wrote:
>>  >>  >
>>  >>  > why do you want to pass it to another page for processing?
>>  >>  >
>>  >>  > sounds like you are thinking about the old jsp model. in wicket
>>  >>  > components are stateful and so the lifecycle is different...
>>  >>  >
>>  >>  > the form submits to itself, and updates models of any form
>> components
>>  >>  > inside. then you can override form.onsubmit() and redirect to
>> another
>>  >>  > page if that is what is needed, or just do nothing to have the
>> current
>>  >>  > page rerendered...
>>  >>  >
>>  >>  > -igor
>>  >>  >
>>  >>  > On Wed, Feb 27, 2008 at 7:34 AM, taygolf
>> <[EMAIL PROTECTED]>
>>  >> wrote:
>>  >>  >>
>>  >>  >>  I have been looking at that today but I am still lost.
>>  >>  >>
>>  >>  >>  Basically what I want to do is have a form with panels in it.
>> the
>>  >> panel
>>  >>  >> will
>>  >>  >>  add a textfield everytime it is called. and it will set the
>> markupId
>>  >> to
>>  >>  >> a
>>  >>  >>  unique id that I am generating and well as setOutputMarkupId to
>>  >> true.
>>  >>  >>
>>  >>  >>  Then when the user has submitted the form I want to pass all the
>>  >> form
>>  >>  >> values
>>  >>  >>  to another page for processing.
>>  >>  >>
>>  >>  >>  Is there a way to get the form to submit to a new page by using
>>  >>  >>  setResponsePage or is there a was to get all the form
>> information
>>  >> into a
>>  >>  >>  PageParameters variable and pass it that way in the onSubmit()
>> call?
>>  >>  >>
>>  >>  >>
>>  >>  >>  Thanks for the help
>>  >>  >>
>>  >>  >>  T
>>  >>  >>
>>  >>  >>
>>  >>  >>
>>  >>  >>
>>  >>  >>
>>  >>  >> igor.vaynberg wrote:
>>  >>  >>  >
>>  >>  >>  > when a form is posted all the values the user entered are
>> pushed
>>  >> into
>>  >>  >>  > the model. i suggest you read the models page on the wiki and
>> look
>>  >> at
>>  >>  >>  > forminput example. in wicket you do not have a "post" page,
>> the
>>  >> form
>>  >>  >>  > submits to itself...
>>  >>  >>  >
>>  >>  >>  > -igor
>>  >>  >>  >
>>  >>  >>  >
>>  >>  >>  > On Tue, Feb 26, 2008 at 12:52 PM, taygolf
>>  >> <[EMAIL PROTECTED]>
>>  >>  >>  > wrote:
>>  >>  >>  >>
>>  >>  >>  >>  ok I know I am missing something simple but I do not know
>> what.
>>  >> I
>>  >>  >> have a
>>  >>  >>  >> form
>>  >>  >>  >>  with a CompoundPropertyModel. I am creating several
>> textfields
>>  >> using
>>  >>  >>  >> panels
>>  >>  >>  >>  so it is all on the fly and can be created from a query.
>>  >>  >>  >>
>>  >>  >>  >>  Anyway I now want to submit my form and get the values in
>> the
>>  >> Post
>>  >>  >> page
>>  >>  >>  >> but
>>  >>  >>  >>  I am not sure how to do this. I am guessing it has something
>> to
>>  >> do
>>  >>  >> with
>>  >>  >>  >>  PageParameters but I have not gotten the right call yet.
>>  >>  >>  >>
>>  >>  >>  >>  SO the question is simple. How do I get all the values from
>> a
>>  >> form
>>  >>  >> after
>>  >>  >>  >> it
>>  >>  >>  >>  is posted on another page. in JSP I would call
>>  >>  >>  >>  request.getParameter("filedname"); What do I do for wicket?
>>  >>  >>  >>
>>  >>  >>  >>  I am really not sure where to look but i have been playing
>> with
>>  >>  >>  >>  PageParameters and form.getMarkupAttributes with no luck so
>> far.
>>  >>  >> Please
>>  >>  >>  >>  point me in the right direction
>>  >>  >>  >>
>>  >>  >>  >>  Thanks for the help
>>  >>  >>  >>
>>  >>  >>  >>  T
>>  >>  >>  >>  --
>>  >>  >>  >>  View this message in context:
>>  >>  >>  >>
>>  >>  >>
>>  >>
>> http://www.nabble.com/get-Form-information-after-submit-tp15699234p15699234.html
>>  >>  >>  >>  Sent from the Wicket - User mailing list archive at
>> Nabble.com.
>>  >>  >>  >>
>>  >>  >>  >>
>>  >>  >>  >>
>>  >>  >>
>> ---------------------------------------------------------------------
>>  >>  >>  >>  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]
>>  >>  >>  >
>>  >>  >>  >
>>  >>  >>  >
>>  >>  >>
>>  >>  >>  --
>>  >>  >>  View this message in context:
>>  >>  >>
>>  >>
>> http://www.nabble.com/get-Form-information-after-submit-tp15699234p15715751.html
>>  >>  >>
>>  >>  >>
>>  >>  >> Sent from the Wicket - User mailing list archive at Nabble.com.
>>  >>  >>
>>  >>  >>
>>  >>  >>
>>  >> ---------------------------------------------------------------------
>>  >>  >>  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]
>>  >>  >
>>  >>  >
>>  >>  >
>>  >>
>>  >>  --
>>  >>  View this message in context:
>>  >>
>> http://www.nabble.com/get-Form-information-after-submit-tp15699234p15720766.html
>>  >>
>>  >>
>>  >> Sent from the Wicket - User mailing list archive at Nabble.com.
>>  >>
>>  >>
>>  >> 
>> ---------------------------------------------------------------------
>>  >>  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]
>>  >
>>  >
>>  >
>>
>>  --
>>  View this message in context:
>> http://www.nabble.com/get-Form-information-after-submit-tp15699234p15724227.html
>>
>>
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>>  ---------------------------------------------------------------------
>>  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]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/get-Form-information-after-submit-tp15699234p15745566.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to