You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Mario Ivankovits <ma...@ops.co.at> on 2006/10/10 19:51:21 UTC
[announcement] new sandbox component: submitOnEvent
Hi!
I am proud to announce a new sandbox component named submitOnEvent
This components aims to do whats described in [1] and [2]
For examples please have a look at
http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/submitOnEventInput.jsp?view=markup
http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/submitOnEventLink.jsp?view=markup
http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/submitOnEventGlobal.jsp?view=markup
just search for s:submitOnEvent to get a clue about the different modes.
See also [3] for the proposal which was the plan for the component.
A wiki page should follow soon, though, maybe some of you are willing to
donate a page? *hinthint* ;-)
I've tested it with Firefox and IE.
Have fun!
Ciao,
Mario
[1] http://wiki.apache.org/myfaces/SubmitPageOnValueChange
[2] http://wiki.apache.org/myfaces/JavascriptWithJavaServerFaces
[3] http://issues.apache.org/jira/browse/TOMAHAWK-730
Re: [announcement] new sandbox component: submitOnEvent
Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi Jeff!
> I believe I have answered my own question.
Sorry, I've missed your last mail :-(
> If I first test to ensure the more complicated use-case works as
> expected, do you mind if I update that wiki page with this additional
> detail about the options for use of the "for" attribute?
No, please go ahead and update the Wiki page as required :-)
Ciao,
Mario
Re: [announcement] new sandbox component: submitOnEvent
Posted by Jeff Bischoff <jb...@klkurz.com>.
Hey all,
I believe I have answered my own question. I have reviewed the source
code for the submitOnEvent component, and I can see that Mario is using
the UIComponent.findComponent() method to locate the component
referenced by the "for" attribute. That find method uses an algorithm
described here [1].
Based on my reading of this description, I believe the short answer to
my question is "Yes!!". If you use a simple "for" attribute like
"submitButton", it will look in that same naming container. If, however,
you prefix it like ":MyMainForm:MySubView:MySubForm:submitButton", you
can specify precisely in which naming container to search for
"submitButton", in this case "MyMainForm:MySubView:MySubForm".
Mario:
I like how you are doing the search at render-time. Since my solutions
to this use-case were all simple client-side javascript functions, I
never thought of that option. It's not that much harder to do in
javascript, but this is better I think.
If I first test to ensure the more complicated use-case works as
expected, do you mind if I update that wiki page with this additional
detail about the options for use of the "for" attribute?
[1]
http://java.sun.com/javaee/javaserverfaces/1.1_01/docs/api/javax/faces/component/UIComponent.html#findComponent(java.lang.String)
Regards,
Jeff Bischoff
Kenneth L Kurz & Associates, Inc.
Jeff Bischoff wrote:
>
>>> I notice you didn't need to forceID the submit buttons on the example.
>>> Do we run into any ID trouble with subviews, forms, subforms, etc?
>> Shouldn't be a problem. I use the JSF computed client-id, and if there
>> isn't a bug in this computation (there were in the past ;-) ) it should
>> work.
>
> Okay, so if they are in the same context then it works without a
> forceid. But, devil's advocate, what happens if say the button is in a
> subform or subview, and the submitOnEvent tag is not. Is there any
> support for this? The button would then have a different client id
> prefix. Tomahawk buttons have a similar "actionFor" attribute, and in
> that case the syntax is like ":MyMainForm:MySubView:MySubForm". Are
> arguments in a form similar to this valid in the submitOnEvent component?
>
>>> <h:outputLabel for="text2" value="submit via link on enter"/>
>>> <h:inputText id="text2" value="#{submitOnEvent.strings.text2}"
>>> onkeypress="javascript:notifyOriginalEvent()">
>>> <s:submitOnEvent for="submitLink" />
>>> </h:inputText>
>>>
>>> How does it know that onEnter() is the event to submit on?
>> Well, my first idea was to create a "submitOnEnter" component, then, we
>> decided to allow a broader use-case and allow to configure the event,
>> following the "convention-before-configuration" paradigm all default
>> values of the submitOnEvent are so that it will trigger "onkeypress" and
>> the "enter" key.
>>
>> Yea, I admit it is somehow confusing, but once you know this it is a
>> real time saver ;-)
>
> The convention is not so confusing, now that it is documented. It was
> simply hard trying to deduce it from the examples alone. Thanks for
> getting that page up so fast.
>
> Regards,
>
> Jeff Bischoff
> Kenneth L Kurz & Associates, Inc.
>
>
>
>
>
Re: [announcement] new sandbox component: submitOnEvent
Posted by Jeff Bischoff <jb...@klkurz.com>.
>> I notice you didn't need to forceID the submit buttons on the example.
>> Do we run into any ID trouble with subviews, forms, subforms, etc?
> Shouldn't be a problem. I use the JSF computed client-id, and if there
> isn't a bug in this computation (there were in the past ;-) ) it should
> work.
Okay, so if they are in the same context then it works without a
forceid. But, devil's advocate, what happens if say the button is in a
subform or subview, and the submitOnEvent tag is not. Is there any
support for this? The button would then have a different client id
prefix. Tomahawk buttons have a similar "actionFor" attribute, and in
that case the syntax is like ":MyMainForm:MySubView:MySubForm". Are
arguments in a form similar to this valid in the submitOnEvent component?
>> <h:outputLabel for="text2" value="submit via link on enter"/>
>> <h:inputText id="text2" value="#{submitOnEvent.strings.text2}"
>> onkeypress="javascript:notifyOriginalEvent()">
>> <s:submitOnEvent for="submitLink" />
>> </h:inputText>
>>
>> How does it know that onEnter() is the event to submit on?
> Well, my first idea was to create a "submitOnEnter" component, then, we
> decided to allow a broader use-case and allow to configure the event,
> following the "convention-before-configuration" paradigm all default
> values of the submitOnEvent are so that it will trigger "onkeypress" and
> the "enter" key.
>
> Yea, I admit it is somehow confusing, but once you know this it is a
> real time saver ;-)
The convention is not so confusing, now that it is documented. It was
simply hard trying to deduce it from the examples alone. Thanks for
getting that page up so fast.
Regards,
Jeff Bischoff
Kenneth L Kurz & Associates, Inc.
Re: [announcement] new sandbox component: submitOnEvent
Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi Jeff!
> I notice you didn't need to forceID the submit buttons on the example.
> Do we run into any ID trouble with subviews, forms, subforms, etc?
Shouldn't be a problem. I use the JSF computed client-id, and if there
isn't a bug in this computation (there were in the past ;-) ) it should
work.
> <h:outputLabel for="text2" value="submit via link on enter"/>
> <h:inputText id="text2" value="#{submitOnEvent.strings.text2}"
> onkeypress="javascript:notifyOriginalEvent()">
> <s:submitOnEvent for="submitLink" />
> </h:inputText>
>
> How does it know that onEnter() is the event to submit on?
Well, my first idea was to create a "submitOnEnter" component, then, we
decided to allow a broader use-case and allow to configure the event,
following the "convention-before-configuration" paradigm all default
values of the submitOnEvent are so that it will trigger "onkeypress" and
the "enter" key.
Yea, I admit it is somehow confusing, but once you know this it is a
real time saver ;-)
Ciao,
Mario
Re: [announcement] new sandbox component: submitOnEvent
Posted by Jeff Bischoff <jb...@klkurz.com>.
Great!
Seems like a common requirement, always figured this would end up as a
tomahawk/sandbox component at some point. Looks interesting.
<s:submitOnEvent for="submitButton" event="change" />
I like this usage syntax - very straightfoward. I notice you didn't need
to forceID the submit buttons on the example. Do we run into any ID
trouble with subviews, forms, subforms, etc?
The usage in some of the other examples confuses me a little...
<h:outputLabel for="text2" value="submit via link on enter"/>
<h:inputText id="text2" value="#{submitOnEvent.strings.text2}"
onkeypress="javascript:notifyOriginalEvent()">
<s:submitOnEvent for="submitLink" />
</h:inputText>
How does it know that onEnter() is the event to submit on?
Looking forward to testing it out for real!
Regards,
Jeff Bischoff
Kenneth L Kurz & Associates, Inc.
Mario Ivankovits wrote:
> Hi!
>
> I am proud to announce a new sandbox component named submitOnEvent
>
> This components aims to do whats described in [1] and [2]
>
> For examples please have a look at
>
> http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/submitOnEventInput.jsp?view=markup
> http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/submitOnEventLink.jsp?view=markup
> http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/submitOnEventGlobal.jsp?view=markup
>
> just search for s:submitOnEvent to get a clue about the different modes.
> See also [3] for the proposal which was the plan for the component.
>
> A wiki page should follow soon, though, maybe some of you are willing to
> donate a page? *hinthint* ;-)
>
> I've tested it with Firefox and IE.
>
> Have fun!
> Ciao,
> Mario
>
> [1] http://wiki.apache.org/myfaces/SubmitPageOnValueChange
> [2] http://wiki.apache.org/myfaces/JavascriptWithJavaServerFaces
> [3] http://issues.apache.org/jira/browse/TOMAHAWK-730
>
>
>
>
Re: [announcement] new sandbox component: submitOnEvent
Posted by Andrew Robinson <an...@gmail.com>.
Great to see this component. Hopefully this will lower the number of
people asking how to do this (despite there already being a WIKI
present on it). Perhaps the component will satisfy the need.
Thanks for writing it.
-Andrew
On 10/11/06, Mario Ivankovits <ma...@ops.co.at> wrote:
> Hi!
> > A wiki page should follow soon, though, maybe some of you are willing to
> > donate a page? *hinthint* ;-)
> >
> And here it is: http://wiki.apache.org/myfaces/SubmitOnEvent
>
> Ciao,
> Mario
>
>
Re: [announcement] new sandbox component: submitOnEvent
Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
> A wiki page should follow soon, though, maybe some of you are willing to
> donate a page? *hinthint* ;-)
>
And here it is: http://wiki.apache.org/myfaces/SubmitOnEvent
Ciao,
Mario