You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by sun quanzhi <su...@hotmail.com> on 2006/12/02 11:54:03 UTC

tapestry4.1.1 ajax issue

hi
My english is not well,so i write simplely,hope you can understand.
I edit the TimeTracker example.
I change the updateComponent content (For example set descriptionField),but 
not have effect.
If I not change ,it work good.
Can you tell me ,what's the proplem? Thanks.
Error Info:
DEBUG: 18:31:29: Response recieved.
DEBUG: 18:31:29: Received element content for id <taskFormhidden> of:
DEBUG: 18:31:29: Received element content for id <descriptionField> of:
ERROR: 18:31:29: Error received in IO response.  : 
XMLHttpTransport.watchInFlight Error: [object Error]
DEBUG:  XMLHttpTransport error callback failed: [object Object]

I  changed source: 
@EventListener(targets = "projectChoose", events = "onValueChanged", 
submitForm = "taskForm",async=true)
    public void projectSelected()
    {
    	_log.info("projectSelected");
    	 
System.out.println(getSelectedProject().getName()+":"+getSelectedProject().getId());

    	this.setDescription("sss");
    	 _log.info("projectSelected	1");
        getBuilder().updateComponent("descriptionField");
        _log.info(" out projectSelected");
    }

_________________________________________________________________
与联机的朋友进行交流,请使用 Live Messenger; 
http://get.live.com/messenger/overview 


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


Re: tapestry4.1.1 ajax issue

Posted by Sam Gendler <sg...@ideasculptor.com>.
I don't know the page you edited to get this, as I don't know the
TimeTracker app, but there has always been a problem with components
that are in loops, since the id in the html file will not match the id
of the html element, since it may have '_x' (where x is an integer)
appended to it.  Other components just don't use the tapestry id as
the id for the corresponding html element.  In the case of a loop or
table, it is usually easiest (necessary?) to put the entire list or
table inside a div and then update that div.  In the case of a
component that just doesn't match the html id to the component id, a
div works very nicely and isn't really any more expensive.

<div jwcid="descriptionFieldWrapper@Any" id="descriptionFieldWrapper">
    <span jwcid="descriptionField" .../>
</div>

or

<div jwcid="descriptionFieldWrapper@Any" id="descriptionFieldWrapper">
    <span jwcid="@contrib:Table" .../>
        ....
    </span>
</div>

getBuilder().updateComponent("descriptionFieldWrapper") will then
cause the wrapper and the contents to be rerendered.

--sam

On 12/2/06, sun quanzhi <su...@hotmail.com> wrote:
> hi
> My english is not well,so i write simplely,hope you can understand.
> I edit the TimeTracker example.
> I change the updateComponent content (For example set descriptionField),but
> not have effect.
> If I not change ,it work good.
> Can you tell me ,what's the proplem? Thanks.
> Error Info:
> DEBUG: 18:31:29: Response recieved.
> DEBUG: 18:31:29: Received element content for id <taskFormhidden> of:
> DEBUG: 18:31:29: Received element content for id <descriptionField> of:
> ERROR: 18:31:29: Error received in IO response.  :
> XMLHttpTransport.watchInFlight Error: [object Error]
> DEBUG:  XMLHttpTransport error callback failed: [object Object]
>
> I  changed source:
> @EventListener(targets = "projectChoose", events = "onValueChanged",
> submitForm = "taskForm",async=true)
>     public void projectSelected()
>     {
>         _log.info("projectSelected");
>
> System.out.println(getSelectedProject().getName()+":"+getSelectedProject().getId());
>
>         this.setDescription("sss");
>          _log.info("projectSelected     1");
>         getBuilder().updateComponent("descriptionField");
>         _log.info(" out projectSelected");
>     }
>
> _________________________________________________________________
> 与联机的朋友进行交流,请使用 Live Messenger;
> http://get.live.com/messenger/overview
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>