You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Dave <ja...@yahoo.com> on 2008/02/01 03:26:58 UTC
submitOnEvent callback
for <s:submitOnEvent>, in my case, whether to submit depends on a bean variable. So I need a "rendered" property.
<h:selectOneMenu .... >
<s:submitOnEvent for="aButton" event="change" rendered="#{bean.submitOnChange}" />
</h:selectOneMenu>
<h:commandButton id="aButton" .../>
But the <s:submitOnEvent> does not have a rendered property. It has a callback for the purpose. The callback function's signature
function mySpecialUserCallback(event, srcComponentId, clickComponentId);
How to let the callback function use the backing bean's variable?
If the callback is javascript code, it can serve the purpose
callback="#{bean.variable? return true: return false}"
Thanks for help
Dave
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
Re: submitOnEvent callback
Posted by Martin Marinschek <ma...@gmail.com>.
Bug is resolved - please try with the nightly snapshot. In any case,
rendered should have worked before.
regards,
Martin
On Feb 2, 2008 2:29 AM, Dave <ja...@yahoo.com> wrote:
> Hi Martin,
> I have filed a bug in MyFaces jira.
>
> http://issues.apache.org/jira/browse/TOMAHAWK-1187
>
> I also suggest adding a onsubmit="javascript code" that can return
> true/false.
>
> Thanks.
> dave
>
> *Martin Marinschek <ma...@gmail.com>* wrote:
>
> I have prepared a fix and will commit it, if someone (Dave?) provides
> me with an issue-number ;)
>
> regards,
>
> Martin
>
> On 2/1/08, Martin Marinschek wrote:
> > Hi guys,
> >
> > the clue is that restoreState/saveState was implemented wrongly in
> > submitOnEvent - another reason to get the component-generator up and
> > running. This is the erronous code - it uses the getter to access the
> > component-attributes (and will therefore store the return-value of the
> > method as local value...)
> >
> > public Object saveState(FacesContext context)
> > {
> > return new Object[]
> > {
> > super.saveState(context),
> > getFor(),
> > getEvent(),
> > getCallback()
> > };
> > }
> >
> > public void restoreState(FacesContext context, Object state)
> > {
> > Object[] states = (Object[]) state;
> > super.restoreState(context, states[0]);
> > forComponent = (String) states[1];
> > event = (String) states[2];
> > callback = (String) states[3];
> > }
> >
> > On 2/1/08, Gerald Müllan wrote:
> > > Hi Dave,
> > >
> > > don`t know why the method is not called, maybe Mario knows it.
> > >
> > > It`s not that nice, but you may also write:
> > >
> > > callback="mySpecialUserCallback"
> > >
> > > ..
> > >
> > > function mySpecialUserCallback(event, srcComponentId,
> clickComponentId)
> > > {
> > > return #{bean.submitOnChange};
> > > }
> > >
> > > This should work without any problems;
> > >
> > > cheers,
> > >
> > > Gerald
> > >
> > > On Feb 1, 2008 11:53 AM, Dave wrote:
> > > > the bean method return a string that is a javascript function name.
> > > >
> > > >
> > > >
> > > > Mario Ivankovits wrote:
> > > > Hi!
> > > > > callback="#{bean.callbackFunction}"
> > > > The callback should point to a javascript function name instead of a
> > > > bean method. callback is meant to be executed on the client.
> > > >
> > > > This javascript method then should allow you to return true/false,
> on
> > > > false the click should not happen.
> > > >
> > > > Ciao,
> > > > Mario
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > ________________________________
> > > > Looking for last minute shopping deals? Find them fast with Yahoo!
> > Search.
> > >
> > >
> > >
> > > --
> > > http://www.irian.at
> > >
> > > Your JSF powerhouse -
> > > JSF Consulting, Development and
> > > Courses in English and German
> > >
> > > Professional Support for Apache MyFaces
> > >
> >
> >
> > --
> >
> > http://www.irian.at
> >
> > Your JSF powerhouse -
> > JSF Consulting, Development and
> > Courses in English and German
> >
> > Professional Support for Apache MyFaces
> >
>
>
> --
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>
>
> ------------------------------
> Looking for last minute shopping deals? Find them fast with Yahoo! Search.<http://us.rd.yahoo.com/evt=51734/*http://tools.search.yahoo.com/newsearch/category.php?category=shopping>
>
--
http://www.irian.at
Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German
Professional Support for Apache MyFaces
Re: submitOnEvent callback
Posted by Dave <ja...@yahoo.com>.
Hi Martin,
I have filed a bug in MyFaces jira.
http://issues.apache.org/jira/browse/TOMAHAWK-1187
I also suggest adding a onsubmit="javascript code" that can return true/false.
Thanks.
dave
Martin Marinschek <ma...@gmail.com> wrote:
I have prepared a fix and will commit it, if someone (Dave?) provides
me with an issue-number ;)
regards,
Martin
On 2/1/08, Martin Marinschek wrote:
> Hi guys,
>
> the clue is that restoreState/saveState was implemented wrongly in
> submitOnEvent - another reason to get the component-generator up and
> running. This is the erronous code - it uses the getter to access the
> component-attributes (and will therefore store the return-value of the
> method as local value...)
>
> public Object saveState(FacesContext context)
> {
> return new Object[]
> {
> super.saveState(context),
> getFor(),
> getEvent(),
> getCallback()
> };
> }
>
> public void restoreState(FacesContext context, Object state)
> {
> Object[] states = (Object[]) state;
> super.restoreState(context, states[0]);
> forComponent = (String) states[1];
> event = (String) states[2];
> callback = (String) states[3];
> }
>
> On 2/1/08, Gerald Müllan wrote:
> > Hi Dave,
> >
> > don`t know why the method is not called, maybe Mario knows it.
> >
> > It`s not that nice, but you may also write:
> >
> > callback="mySpecialUserCallback"
> >
> > ..
> >
> > function mySpecialUserCallback(event, srcComponentId, clickComponentId)
> > {
> > return #{bean.submitOnChange};
> > }
> >
> > This should work without any problems;
> >
> > cheers,
> >
> > Gerald
> >
> > On Feb 1, 2008 11:53 AM, Dave wrote:
> > > the bean method return a string that is a javascript function name.
> > >
> > >
> > >
> > > Mario Ivankovits wrote:
> > > Hi!
> > > > callback="#{bean.callbackFunction}"
> > > The callback should point to a javascript function name instead of a
> > > bean method. callback is meant to be executed on the client.
> > >
> > > This javascript method then should allow you to return true/false, on
> > > false the click should not happen.
> > >
> > > Ciao,
> > > Mario
> > >
> > >
> > >
> > >
> > >
> > > ________________________________
> > > Looking for last minute shopping deals? Find them fast with Yahoo!
> Search.
> >
> >
> >
> > --
> > http://www.irian.at
> >
> > Your JSF powerhouse -
> > JSF Consulting, Development and
> > Courses in English and German
> >
> > Professional Support for Apache MyFaces
> >
>
>
> --
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>
--
http://www.irian.at
Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German
Professional Support for Apache MyFaces
---------------------------------
Looking for last minute shopping deals? Find them fast with Yahoo! Search.
Re: submitOnEvent callback
Posted by Martin Marinschek <ma...@gmail.com>.
I have prepared a fix and will commit it, if someone (Dave?) provides
me with an issue-number ;)
regards,
Martin
On 2/1/08, Martin Marinschek <ma...@gmail.com> wrote:
> Hi guys,
>
> the clue is that restoreState/saveState was implemented wrongly in
> submitOnEvent - another reason to get the component-generator up and
> running. This is the erronous code - it uses the getter to access the
> component-attributes (and will therefore store the return-value of the
> method as local value...)
>
> public Object saveState(FacesContext context)
> {
> return new Object[]
> {
> super.saveState(context),
> getFor(),
> getEvent(),
> getCallback()
> };
> }
>
> public void restoreState(FacesContext context, Object state)
> {
> Object[] states = (Object[]) state;
> super.restoreState(context, states[0]);
> forComponent = (String) states[1];
> event = (String) states[2];
> callback = (String) states[3];
> }
>
> On 2/1/08, Gerald Müllan <ge...@gmail.com> wrote:
> > Hi Dave,
> >
> > don`t know why the method is not called, maybe Mario knows it.
> >
> > It`s not that nice, but you may also write:
> >
> > callback="mySpecialUserCallback"
> >
> > ..
> >
> > function mySpecialUserCallback(event, srcComponentId, clickComponentId)
> > {
> > return #{bean.submitOnChange};
> > }
> >
> > This should work without any problems;
> >
> > cheers,
> >
> > Gerald
> >
> > On Feb 1, 2008 11:53 AM, Dave <ja...@yahoo.com> wrote:
> > > the bean method return a string that is a javascript function name.
> > >
> > >
> > >
> > > Mario Ivankovits <ma...@ops.co.at> wrote:
> > > Hi!
> > > > callback="#{bean.callbackFunction}"
> > > The callback should point to a javascript function name instead of a
> > > bean method. callback is meant to be executed on the client.
> > >
> > > This javascript method then should allow you to return true/false, on
> > > false the click should not happen.
> > >
> > > Ciao,
> > > Mario
> > >
> > >
> > >
> > >
> > >
> > > ________________________________
> > > Looking for last minute shopping deals? Find them fast with Yahoo!
> Search.
> >
> >
> >
> > --
> > http://www.irian.at
> >
> > Your JSF powerhouse -
> > JSF Consulting, Development and
> > Courses in English and German
> >
> > Professional Support for Apache MyFaces
> >
>
>
> --
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>
--
http://www.irian.at
Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German
Professional Support for Apache MyFaces
Re: submitOnEvent callback
Posted by Martin Marinschek <ma...@gmail.com>.
Hi guys,
the clue is that restoreState/saveState was implemented wrongly in
submitOnEvent - another reason to get the component-generator up and
running. This is the erronous code - it uses the getter to access the
component-attributes (and will therefore store the return-value of the
method as local value...)
public Object saveState(FacesContext context)
{
return new Object[]
{
super.saveState(context),
getFor(),
getEvent(),
getCallback()
};
}
public void restoreState(FacesContext context, Object state)
{
Object[] states = (Object[]) state;
super.restoreState(context, states[0]);
forComponent = (String) states[1];
event = (String) states[2];
callback = (String) states[3];
}
On 2/1/08, Gerald Müllan <ge...@gmail.com> wrote:
> Hi Dave,
>
> don`t know why the method is not called, maybe Mario knows it.
>
> It`s not that nice, but you may also write:
>
> callback="mySpecialUserCallback"
>
> ..
>
> function mySpecialUserCallback(event, srcComponentId, clickComponentId)
> {
> return #{bean.submitOnChange};
> }
>
> This should work without any problems;
>
> cheers,
>
> Gerald
>
> On Feb 1, 2008 11:53 AM, Dave <ja...@yahoo.com> wrote:
> > the bean method return a string that is a javascript function name.
> >
> >
> >
> > Mario Ivankovits <ma...@ops.co.at> wrote:
> > Hi!
> > > callback="#{bean.callbackFunction}"
> > The callback should point to a javascript function name instead of a
> > bean method. callback is meant to be executed on the client.
> >
> > This javascript method then should allow you to return true/false, on
> > false the click should not happen.
> >
> > Ciao,
> > Mario
> >
> >
> >
> >
> >
> > ________________________________
> > Looking for last minute shopping deals? Find them fast with Yahoo! Search.
>
>
>
> --
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>
--
http://www.irian.at
Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German
Professional Support for Apache MyFaces
Re: submitOnEvent callback
Posted by Gerald Müllan <ge...@gmail.com>.
Hi Dave,
don`t know why the method is not called, maybe Mario knows it.
It`s not that nice, but you may also write:
callback="mySpecialUserCallback"
..
function mySpecialUserCallback(event, srcComponentId, clickComponentId)
{
return #{bean.submitOnChange};
}
This should work without any problems;
cheers,
Gerald
On Feb 1, 2008 11:53 AM, Dave <ja...@yahoo.com> wrote:
> the bean method return a string that is a javascript function name.
>
>
>
> Mario Ivankovits <ma...@ops.co.at> wrote:
> Hi!
> > callback="#{bean.callbackFunction}"
> The callback should point to a javascript function name instead of a
> bean method. callback is meant to be executed on the client.
>
> This javascript method then should allow you to return true/false, on
> false the click should not happen.
>
> Ciao,
> Mario
>
>
>
>
>
> ________________________________
> Looking for last minute shopping deals? Find them fast with Yahoo! Search.
--
http://www.irian.at
Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German
Professional Support for Apache MyFaces
Re: submitOnEvent callback
Posted by Dave <ja...@yahoo.com>.
the bean method return a string that is a javascript function name.
Mario Ivankovits <ma...@ops.co.at> wrote: Hi!
> callback="#{bean.callbackFunction}"
The callback should point to a javascript function name instead of a
bean method. callback is meant to be executed on the client.
This javascript method then should allow you to return true/false, on
false the click should not happen.
Ciao,
Mario
---------------------------------
Looking for last minute shopping deals? Find them fast with Yahoo! Search.
Re: submitOnEvent callback
Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
> callback="#{bean.callbackFunction}"
The callback should point to a javascript function name instead of a
bean method. callback is meant to be executed on the client.
This javascript method then should allow you to return true/false, on
false the click should not happen.
Ciao,
Mario
Re: submitOnEvent callback
Posted by Dave <ja...@yahoo.com>.
callback="#{bean.callbackFunction}"
The bean method is not called.
Dave <ja...@yahoo.com> wrote: for <s:submitOnEvent>, in my case, whether to submit depends on a bean variable. So I need a "rendered" property.
<h:selectOneMenu .... >
<s:submitOnEvent for="aButton" event="change" rendered="#{bean.submitOnChange}" />
</h:selectOneMenu>
<h:commandButton id="aButton" .../>
But the <s:submitOnEvent> does not have a rendered property. It has a callback for the purpose. The callback function's signature
function mySpecialUserCallback(event, srcComponentId, clickComponentId);
How to let the callback function use the backing bean's variable?
If the callback is javascript code, it can serve the purpose
callback="#{bean.variable? return true: return false}"
Thanks for help
Dave
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
---------------------------------
Looking for last minute shopping deals? Find them fast with Yahoo! Search.