You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jean-Philippe Steinmetz <st...@ISI.EDU> on 2007/10/12 23:15:56 UTC

T5: Form not saving all elements

Hi all,
 
So I have a form that has several elements. A few of the elements are not
done using the tapestry components and use regular HTML because the required
steps to make things work as needed with the components is simply not a
suitable solution. So how do I get these regular form elements to save
properly?
 
Jean-Philippe

RE: T5: Form not saving all elements

Posted by Jean-Philippe Steinmetz <st...@ISI.EDU>.
Yes it's the same form but I have other elements of the form as well that do
not use the components. I will look into using this setup however. When I
originally was looking for something similar it didn't appear to be that
simple so I'll give this a try. Thanks again.

Jean-Philippe

> -----Original Message-----
> From: joshcanfield@gmail.com [mailto:joshcanfield@gmail.com] 
> On Behalf Of Josh Canfield
> Sent: Friday, October 12, 2007 3:37 PM
> To: Tapestry users
> Subject: Re: T5: Form not saving all elements
> 
> You can grab the the parameters directly from the request
> 
> @Inject
> Request _request;
> 
> _request.getParameter("fieldName");
> 
> You'll have to deal with the potential for strange values, null, etc.
> 
> Although, if this is for your selection list problem from 
> earlier I believe a better solution might be to create a map 
> and use that as the model for your the t:select component.
> 
> Create a property:
> private HashMap<String, String> _schoolModel; private String 
> _schoolId;
> 
> in setup render:
> 
> for ( School school : getSchools() ) {
>   String value = school.getName() + " - " + school.getLocation();
>   String key = school.getId().toString();
>   _schoolModel.put(key, value);
> }
> 
> in your template:
> 
> School: <t:select t:id="schoolId" t:model="schoolModel"/>
> 
> I haven't compiled this code, so there might be typos/bugs, 
> but that's the gist.
> 
> Josh
> 
> 
> On 10/12/07, Jean-Philippe Steinmetz <st...@isi.edu> wrote:
> >
> > Hi all,
> >
> > So I have a form that has several elements. A few of the 
> elements are 
> > not done using the tapestry components and use regular HTML because 
> > the required steps to make things work as needed with the 
> components 
> > is simply not a suitable solution. So how do I get these 
> regular form 
> > elements to save properly?
> >
> > Jean-Philippe
> >
> 
> 
> 
> --
> --
> TheDailyTube.com. Sign up and get the best new videos on the 
> internet delivered fresh to your inbox.
> 


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


Re: T5: Form not saving all elements

Posted by Josh Canfield <jo...@thedailytube.com>.
I can't compile anything right now, but I would guess that you need a
getter/setter for schoolId (String getSchoolId(), setSchoolId(String))

If you have the getter/setter already then add t:value="schoolId".


On 10/16/07, Angelo Chen <an...@yahoo.com.hk> wrote:
>
>
> Hi Josh,
>
> i tried your code, here is my version:
> private HashMap<String, String> _schoolModel;
>    private String _schoolId;
>
>    public HashMap<String, String> getschoolModel() {
>        return _schoolModel;
>    }
>
>    void setupRender() {
>        _schoolModel.put("1", "student 1");
>        _schoolModel.put("2", "student 2");
>    }
>
> <t:select t:id="schoolId" t:model="schoolModel"/>
>
> but I got an error:
>
> Parameter(s) value are required for
> org.apache.tapestry.corelib.components.Select, but have not been bound.
>
> looks like I have to add a t:value, but how? thanks.
> A.C.
>
>
>
> Josh Canfield-2 wrote:
> >
> > You can grab the the parameters directly from the request
> >
> > Although, if this is for your selection list problem from earlier I
> > believe
> > a better solution might be to create a map and use that as the model for
> > your the t:select component.
> >
> > Create a property:
> > private HashMap<String, String> _schoolModel;
> > private String _schoolId;
> >
> > in setup render:
> >
> > for ( School school : getSchools() ) {
> >   String value = school.getName() + " - " + school.getLocation();
> >   String key = school.getId().toString();
> >   _schoolModel.put(key, value);
> > }
> >
> > in your template:
> >
> > School: <t:select t:id="schoolId" t:model="schoolModel"/>
> >
> > I haven't compiled this code, so there might be typos/bugs, but that's
> the
> > gist.
> >
> > Josh
> >
> >
> > On 10/12/07, Jean-Philippe Steinmetz <st...@isi.edu> wrote:
> >>
> >> Hi all,
> >>
> >> So I have a form that has several elements. A few of the elements are
> not
> >> done using the tapestry components and use regular HTML because the
> >> required
> >> steps to make things work as needed with the components is simply not a
> >> suitable solution. So how do I get these regular form elements to save
> >> properly?
> >>
> >> Jean-Philippe
> >>
> >
> >
> >
> > --
> > --
> > TheDailyTube.com. Sign up and get the best new videos on the internet
> > delivered fresh to your inbox.
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/T5%3A-Form-not-saving-all-elements-tf4616073.html#a13238297
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

Re: T5: Form not saving all elements

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Josh,

i tried your code, here is my version:
 private HashMap<String, String> _schoolModel;
    private String _schoolId;

    public HashMap<String, String> getschoolModel() {
        return _schoolModel;
    }

    void setupRender() {
        _schoolModel.put("1", "student 1");
        _schoolModel.put("2", "student 2");
    }
    
 <t:select t:id="schoolId" t:model="schoolModel"/>

but I got an error:

Parameter(s) value are required for
org.apache.tapestry.corelib.components.Select, but have not been bound.

looks like I have to add a t:value, but how? thanks.
A.C.



Josh Canfield-2 wrote:
> 
> You can grab the the parameters directly from the request
> 
> Although, if this is for your selection list problem from earlier I
> believe
> a better solution might be to create a map and use that as the model for
> your the t:select component.
> 
> Create a property:
> private HashMap<String, String> _schoolModel;
> private String _schoolId;
> 
> in setup render:
> 
> for ( School school : getSchools() ) {
>   String value = school.getName() + " - " + school.getLocation();
>   String key = school.getId().toString();
>   _schoolModel.put(key, value);
> }
> 
> in your template:
> 
> School: <t:select t:id="schoolId" t:model="schoolModel"/>
> 
> I haven't compiled this code, so there might be typos/bugs, but that's the
> gist.
> 
> Josh
> 
> 
> On 10/12/07, Jean-Philippe Steinmetz <st...@isi.edu> wrote:
>>
>> Hi all,
>>
>> So I have a form that has several elements. A few of the elements are not
>> done using the tapestry components and use regular HTML because the
>> required
>> steps to make things work as needed with the components is simply not a
>> suitable solution. So how do I get these regular form elements to save
>> properly?
>>
>> Jean-Philippe
>>
> 
> 
> 
> -- 
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-Form-not-saving-all-elements-tf4616073.html#a13238297
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5: Form not saving all elements

Posted by Howard Lewis Ship <hl...@gmail.com>.
The only thing to be aware of is to not collide your manually created text
fields' names with those selected by Tapestry for the form elements.  I.e.,
if you have a component with id "userName" don't create a manual text field
with name="userName".  They'll collide and confuse things.

On 10/12/07, Jean-Philippe Steinmetz <st...@isi.edu> wrote:
>
> Thanks again. I went with the second suggestion and it works beautifully.
>
> Jean-Philippe
>
> > -----Original Message-----
> > From: joshcanfield@gmail.com [mailto:joshcanfield@gmail.com]
> > On Behalf Of Josh Canfield
> > Sent: Friday, October 12, 2007 3:37 PM
> > To: Tapestry users
> > Subject: Re: T5: Form not saving all elements
> >
> > You can grab the the parameters directly from the request
> >
> > @Inject
> > Request _request;
> >
> > _request.getParameter("fieldName");
> >
> > You'll have to deal with the potential for strange values, null, etc.
> >
> > Although, if this is for your selection list problem from
> > earlier I believe a better solution might be to create a map
> > and use that as the model for your the t:select component.
> >
> > Create a property:
> > private HashMap<String, String> _schoolModel; private String
> > _schoolId;
> >
> > in setup render:
> >
> > for ( School school : getSchools() ) {
> >   String value = school.getName() + " - " + school.getLocation();
> >   String key = school.getId().toString();
> >   _schoolModel.put(key, value);
> > }
> >
> > in your template:
> >
> > School: <t:select t:id="schoolId" t:model="schoolModel"/>
> >
> > I haven't compiled this code, so there might be typos/bugs,
> > but that's the gist.
> >
> > Josh
> >
> >
> > On 10/12/07, Jean-Philippe Steinmetz <st...@isi.edu> wrote:
> > >
> > > Hi all,
> > >
> > > So I have a form that has several elements. A few of the
> > elements are
> > > not done using the tapestry components and use regular HTML because
> > > the required steps to make things work as needed with the
> > components
> > > is simply not a suitable solution. So how do I get these
> > regular form
> > > elements to save properly?
> > >
> > > Jean-Philippe
> > >
> >
> >
> >
> > --
> > --
> > TheDailyTube.com. Sign up and get the best new videos on the
> > internet delivered fresh to your inbox.
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
Partner and Senior Architect at Feature50

Creator Apache Tapestry and Apache HiveMind

RE: T5: Form not saving all elements

Posted by Jean-Philippe Steinmetz <st...@ISI.EDU>.
Thanks again. I went with the second suggestion and it works beautifully. 

Jean-Philippe

> -----Original Message-----
> From: joshcanfield@gmail.com [mailto:joshcanfield@gmail.com] 
> On Behalf Of Josh Canfield
> Sent: Friday, October 12, 2007 3:37 PM
> To: Tapestry users
> Subject: Re: T5: Form not saving all elements
> 
> You can grab the the parameters directly from the request
> 
> @Inject
> Request _request;
> 
> _request.getParameter("fieldName");
> 
> You'll have to deal with the potential for strange values, null, etc.
> 
> Although, if this is for your selection list problem from 
> earlier I believe a better solution might be to create a map 
> and use that as the model for your the t:select component.
> 
> Create a property:
> private HashMap<String, String> _schoolModel; private String 
> _schoolId;
> 
> in setup render:
> 
> for ( School school : getSchools() ) {
>   String value = school.getName() + " - " + school.getLocation();
>   String key = school.getId().toString();
>   _schoolModel.put(key, value);
> }
> 
> in your template:
> 
> School: <t:select t:id="schoolId" t:model="schoolModel"/>
> 
> I haven't compiled this code, so there might be typos/bugs, 
> but that's the gist.
> 
> Josh
> 
> 
> On 10/12/07, Jean-Philippe Steinmetz <st...@isi.edu> wrote:
> >
> > Hi all,
> >
> > So I have a form that has several elements. A few of the 
> elements are 
> > not done using the tapestry components and use regular HTML because 
> > the required steps to make things work as needed with the 
> components 
> > is simply not a suitable solution. So how do I get these 
> regular form 
> > elements to save properly?
> >
> > Jean-Philippe
> >
> 
> 
> 
> --
> --
> TheDailyTube.com. Sign up and get the best new videos on the 
> internet delivered fresh to your inbox.
> 


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


Re: T5: Form not saving all elements

Posted by Josh Canfield <jo...@thedailytube.com>.
You can grab the the parameters directly from the request

@Inject
Request _request;

_request.getParameter("fieldName");

You'll have to deal with the potential for strange values, null, etc.

Although, if this is for your selection list problem from earlier I believe
a better solution might be to create a map and use that as the model for
your the t:select component.

Create a property:
private HashMap<String, String> _schoolModel;
private String _schoolId;

in setup render:

for ( School school : getSchools() ) {
  String value = school.getName() + " - " + school.getLocation();
  String key = school.getId().toString();
  _schoolModel.put(key, value);
}

in your template:

School: <t:select t:id="schoolId" t:model="schoolModel"/>

I haven't compiled this code, so there might be typos/bugs, but that's the
gist.

Josh


On 10/12/07, Jean-Philippe Steinmetz <st...@isi.edu> wrote:
>
> Hi all,
>
> So I have a form that has several elements. A few of the elements are not
> done using the tapestry components and use regular HTML because the
> required
> steps to make things work as needed with the components is simply not a
> suitable solution. So how do I get these regular form elements to save
> properly?
>
> Jean-Philippe
>



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.