Hi,

as I said things should start to work if you
use the javascripts, the javascripts rely on full identifiers.
If not with the latest code then please file a bugreport
I have to fix it then :-)


Werner


Am 26.06.10 03:21, schrieb Bytecode:
Werner,

Thanks for the reply.

<h:commandButton value="Login" id="login-button"
onclick="jsf.ajax.request(this,event,{execute:'@this',
render:'form1:out'});return false;">
</h:commandButton>

As you can see the render now is mapped to the full client identifier
form1:out

But the out component is outside form1. So its full identifier is out.
But right now using render="out"
makes JSF search for a component with the "out" component inside form1.
I've yet to try the direct
JavaScript though.

I guess if the JSF team had added another annotation (are they called
annotations in JSF?)
named @root:bar that forced the JSF engine to search for the bar
component from the UIViewRoot
this could have been solved very easily. :-)

Cheers,
Bytecode

On 26 Jun, 2010,at 05:13 AM, Werner Punz <werner.p...@gmail.com> wrote:

Yes you can use the direct javascript api jsf.ajax.request instead of
ajax then you can use full identifiers.

<h:commandButton value="Login" id="login-button">
> <f:ajax execute="user-name password" render="out" />
> </h:commandButton>
would become

<h:commandButton value="Login" id="login-button"
onclick="jsf.ajax.request(this,event,{execute:'@this',
render:'form1:out'});return false;">
</h:commandButton>

As you can see the render now is mapped to the full client identifier
form1:out

That way you can make render submits outside of your form.

However, I have to recommend to update to the latest trunk or the soon
hopefully to be released myfaces 2.0.1 if you want to do cross form
submits or submits with renders outside of your current form.

I did a load of improvement especially in this area for the scripts so
that cases like updating a cross form element does not cause problems
anymore with other forms where the element might be embedded or which
has another form embedded :-)

Here is a code snippet from one of my testing cases dealing exactly with
what you want to achieve:

http://www.pastebin.org/358867

Have in mind that all this works in the current trunk (and soon in
2.0.1), but the 2.0.0 codebase and also Mojarra has some limitations.
(mostly if you update elements which embed forms, or in case of MyFaces
2.0.0 also if you update elements within another form than the issuing
one)



Werner


Am 25.06.10 18:06, schrieb Bytecode:
> Is there a way to make the following code work, apart from placing the
> "#out" component inside the h:form element?
>
> |<?xml version="1.0" encoding="ISO-8859-1" ?>
> <!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt
<http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt>;
> <html xmlns="http://www.w3.org/1999/xhtml";
> xmlns:h="http://java.sun.com/jsf/html";
> xmlns:f="http://java.sun.com/jsf/core"&gt
<http://java.sun.com/jsf/core"&gt>;
> <h:head>
> <title>Welcome</title>
> </h:head>
>
> <h:body>
>
> <h:form id="form1">
>
> <p><h:outputText id="out" value="#{user.greeting}" /></p>
>
> <h:inputText value="#{user.name}" id="user-name" />
> <p><h:inputSecret value="#{user.password}" id="password" /></p>
> <p>
> <h:commandButton value="Login" id="login-button">
> <f:ajax execute="user-name password" render="out" />
> </h:commandButton>
> </p>
> </h:form>
> </h:body>
>
> </html>
> |
>
>
>
> At the moment the following exception is thrown by JSF when rendering
> the page:
>
> |<f:ajax> contains an unknown id'out' - cannot locate it in the
context of the component login-button|




Reply via email to