You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by hese <10...@gmail.com> on 2010/10/25 16:56:53 UTC

dynamically reload a select control

Hi,

I have a select box in my tml -

<select t:type="Select" t:id="adv1"  model="brandModel" value="brandId1" />

I also have an option where values can be added to this select box from that
page.  After the user adds a value I want the select box to repopulate and
display the new value as well.

To accomplish this, at the end of the event handler for adding the new
value, I am doing this

 @OnEvent(component = "inPlaceEditorBrand", value =
InPlaceEditor.SAVE_EVENT)
Object onAddBrand(Long contextId, String brandName) {
{

...
...

setupBrandModel(); //here I am creating the 'brandModel' with the new value
return this;
}

...returning 'this' expecting the page to reload again  and have the new
value.  but the page is not reloading and the select box does not have the
new value.

What is the mistake?  Is there any other way to reload the select box with
the new values without reloading the page?

Thanks

-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/dynamically-reload-a-select-control-tp3235533p3235533.html
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: dynamically reload a select control

Posted by Mark <ma...@xeric.net>.
Earlier I thought you said that the page was not reloading.  Unless you are
doing something with AJAX, I don't know how it would call the function
without loading the page.  If it is reloading the page, you might try having
the method log a list of all the brands right before it returns this--just
to make sure you are getting them all in the list that is used for the
 Select.

Oh and make sure that this list (or however you are storing it) is kept
somewhere that is going to be persistent when the page comes back. You could
be adding the item to the list and then immediately reseting it to the
default when the page reloads.

Mark

On Tue, Oct 26, 2010 at 11:29 AM, hese <10...@gmail.com> wrote:

>
> yes it does get called, the logs that i have in that functions appear.
>
> anyways...will try out your links.
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/dynamically-reload-a-select-control-tp3235533p3237369.html
> 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: dynamically reload a select control

Posted by hese <10...@gmail.com>.
yes it does get called, the logs that i have in that functions appear.

anyways...will try out your links.

-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/dynamically-reload-a-select-control-tp3235533p3237369.html
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: dynamically reload a select control

Posted by Mark <ma...@xeric.net>.
Are you sure that OnAddBranding is getting called when they add a brand?
If the page doesn't reload, then it sounds like the form isn't submitting.

Here is an example of a select component being updated via AJAX that might
help if you don't want to reload the page:
http://jumpstart.doublenegative.com.au/jumpstart/examples/javascript/ajaxselect1
<http://jumpstart.doublenegative.com.au/jumpstart/examples/javascript/ajaxselect1>
Mark

On Mon, Oct 25, 2010 at 9:56 AM, hese <10...@gmail.com> wrote:

>
> Hi,
>
> I have a select box in my tml -
>
> <select t:type="Select" t:id="adv1"  model="brandModel" value="brandId1" />
>
> I also have an option where values can be added to this select box from
> that
> page.  After the user adds a value I want the select box to repopulate and
> display the new value as well.
>
> To accomplish this, at the end of the event handler for adding the new
> value, I am doing this
>
>  @OnEvent(component = "inPlaceEditorBrand", value =
> InPlaceEditor.SAVE_EVENT)
> Object onAddBrand(Long contextId, String brandName) {
> {
>
> ...
> ...
>
> setupBrandModel(); //here I am creating the 'brandModel' with the new value
> return this;
> }
>
> ...returning 'this' expecting the page to reload again  and have the new
> value.  but the page is not reloading and the select box does not have the
> new value.
>
> What is the mistake?  Is there any other way to reload the select box with
> the new values without reloading the page?
>
> Thanks
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/dynamically-reload-a-select-control-tp3235533p3235533.html
> 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
>
>