I think what Jesse says is exactly what is expected and intuitive, but I've just spent 3 hours proving that it needs those "redundant" divs if you want it to work (unless I've misunderstood, or am approaching this wrong).

Case in point, using the Dec 12, 4.1.1 snapshot:

@EventListener( events = "onchange", targets="hotspotSelection", async=true, submitForm = "hotspotSelectForm", validateForm = false)
    public void viewHotspot(IRequestCycle cycle) {
        cycle.getResponseBuilder().updateComponent("hotspotId");
    }

--

<input jwcid="[EMAIL PROTECTED]" value="ognl: selectedHotspot.id" />

--

doesn't work. The proper ajax response is returned with the correct data, but the hotspotId is never updated in js (not sure why).

Wrapping it in a div fixes the problem:

@EventListener( events = "onchange", targets="hotspotSelection", async=true, submitForm = "hotspotSelectForm", validateForm = false)
    public void viewHotspot(IRequestCycle cycle) {
        cycle.getResponseBuilder().updateComponent("hotspotIdDiv");
    }

--

<div jwcid="[EMAIL PROTECTED]"><input jwcid="[EMAIL PROTECTED]" value="ognl: selectedHotspot.id" /></div>

--

Hopefully that helps someone else. BTW, I love the new AJAX functionality and appreciate everyone's work!!

J



On 10-Sep-06, at 8:43 AM, Jesse Kuhnert wrote:

Also, just as an FYI a lot of the examples I've been seeing lately include what appears to be a lot of redundant <div> enclosures around content you
want to update.

I've worked very hard to make sure the component id logic is universally correct, so you should be able to just reference a particular component
directly for updating..

The only time you need to enclose something is when it may not actually be
rendered yet (and therefore not have any html element to replace on an
update)..One example of this is a <span jwcid="@If" > type block.

On 9/9/06, Josh Long <[EMAIL PROTECTED]> wrote:

I'm not 100% sure, but try changing div id ="quoteDiv" to <div
jwcid="[EMAIL PROTECTED]"> ...

That way, builder.updateComponent wil update a tapestry component..

Peace,
Josh

On 9/8/06, Vinicius Carvalho <[EMAIL PROTECTED]> wrote:
> Hello there! Does EventListener + ResponseBuilder supports all
> components? For instance, is it possible to update contents presented
> by a @Insert?
> I was trying a simple quote app and can't get it working:
>
> @EventListener(elements = "fetchQuotes", events="onmouseover")
>         public void getQuotes(IRequestCycle cycle){
> ResponseBuilder builder = cycle.getResponseBuilder();
>                 setQuote(getQuotesFromDB());
>                 builder.updateComponent("quoteDiv");
>
>         }
>
> <div id="fetchQuotes"><span jwcid="@Insert" value="ognl:now"/>Mouse
> over here to get more quotes...</div><br><br>
>
> <div id="quoteDiv"><span jwcid="[EMAIL PROTECTED]"
> value="ognl:quote"></span></div>
>
> What's the right way?
>
>
> Regards
>
> -
--
Julian Wood <[EMAIL PROTECTED]>

Software Engineer
Teaching & Learning Centre
University of Calgary

http://tlc.ucalgary.ca


Reply via email to