You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Mario Ivankovits <ma...@ops.co.at> on 2006/10/09 11:10:30 UTC

new component "submitOnEnter"

Hi!

What do you think about a new component which aims to do whats described
here [1]

It should operate in three modes:

1) as a child of an input* component (direct child)
In this mode submitOnEnter will add a "onkeypress" handler to the input
component and fires the button/link pointed to with "for"

2) standalone somewhere on the page
In this mode submitOnEnter will intercept *all* keystrokes and fires the
button/link pointed to with "for"

3) as a child of a command* component (link or button)
In this mode submitOnEnter will intercept *all* keystrokes and fires the
button/link it is embedded.

It should handle buttons and links - links as described on [2]


The proposed syntax is:

<s:submitOnEnter for="myButton" />

<h:commandLink .... >
    <s:submitOnEnter/>
</h:commandLink>

Even if for some reasons it might be easier, the component should *not*
use dojo.


What do you think?

Ciao,
Mario


[1] http://wiki.apache.org/myfaces/SubmitPageOnValueChange
[2] http://wiki.apache.org/myfaces/JavascriptWithJavaServerFaces


Re: new component "submitOnEnter"

Posted by Werner Punz <we...@gmx.at>.
Martin Marinschek schrieb:
> I like the component idea - definitely a good idea.
> 
> +1 for not using dojo if you use another way of not-intrusively
> attaching the handler (that's not too hard, but still something to
> consider)
> 
> regards,
> 
> Martin
> 
Excellent idea, +1 for that and also +1 for not using dojo if possible
the handler code is relatively small, no need for using a huge lib to
achieve this task.


Re: new component "submitOnEnter"

Posted by Martin Marinschek <ma...@gmail.com>.
I like the component idea - definitely a good idea.

+1 for not using dojo if you use another way of not-intrusively
attaching the handler (that's not too hard, but still something to
consider)

regards,

Martin

On 10/9/06, Ernst Fastl <er...@gmail.com> wrote:
> I would also go for the submitOnEvent component since it seems
> to offer the most flexible and still easy to use solution.
>
> also +1 for not using Dojo. there are already enough components
> dpending on Dojo.
>
> On 10/9/06, Grant Smith <wo...@gmail.com> wrote:
> >
> >
> > On 10/9/06, Mario Ivankovits <ma...@ops.co.at> wrote:
> > > Hi Bruno!
> > > > and would something like submitOnKeyPress (including enter) be more
> > > > general and with broader possibilities?
> > > Do you think about something which allows to configure which keyPress
> > > triggers the submit?
> > > How can such a configuration look like?
> > >
> > > 1) triggerKeys
> > > <s:submitOnKeyPress triggerKeys="#13,A,B,C" />
> > >
> > > Where #xx means 'keycode'.
> > >
> > >
> > > 2) triggerCallback
> > > <s:submitOnKeyPress triggerCallback="anyUserMethod" />
> > >
> > > Where anyUserMethod will be a user defined javascript function which has
> > > to be provided by the user
> > >
> > > I'd vote for method 2 as this is less complicated to code.
> > >
> > >
> > > To further "complicate" ;-) things we could also discuss if we further
> > > abstract the event - something like:
> > >
> > > <s:submitOnEvent event="keypress|change|focus|blur" />
> >
> >
> > I think this component would definitely be worth while. +1 !
> >
> > > Where the default event is "keypress" and for "triggerCallback" the
> > > default is a method which will trigger on "Enter"
> > >
> > >
> > > Ciao,
> > > Mario
> > >
> > >
> >
> >
> >
> > --
> > Grant Smith
> >
>


-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: new component "submitOnEnter"

Posted by Ernst Fastl <er...@gmail.com>.
I would also go for the submitOnEvent component since it seems
to offer the most flexible and still easy to use solution.

also +1 for not using Dojo. there are already enough components
dpending on Dojo.

On 10/9/06, Grant Smith <wo...@gmail.com> wrote:
>
>
> On 10/9/06, Mario Ivankovits <ma...@ops.co.at> wrote:
> > Hi Bruno!
> > > and would something like submitOnKeyPress (including enter) be more
> > > general and with broader possibilities?
> > Do you think about something which allows to configure which keyPress
> > triggers the submit?
> > How can such a configuration look like?
> >
> > 1) triggerKeys
> > <s:submitOnKeyPress triggerKeys="#13,A,B,C" />
> >
> > Where #xx means 'keycode'.
> >
> >
> > 2) triggerCallback
> > <s:submitOnKeyPress triggerCallback="anyUserMethod" />
> >
> > Where anyUserMethod will be a user defined javascript function which has
> > to be provided by the user
> >
> > I'd vote for method 2 as this is less complicated to code.
> >
> >
> > To further "complicate" ;-) things we could also discuss if we further
> > abstract the event - something like:
> >
> > <s:submitOnEvent event="keypress|change|focus|blur" />
>
>
> I think this component would definitely be worth while. +1 !
>
> > Where the default event is "keypress" and for "triggerCallback" the
> > default is a method which will trigger on "Enter"
> >
> >
> > Ciao,
> > Mario
> >
> >
>
>
>
> --
> Grant Smith
>

Re: new component "submitOnEnter"

Posted by Grant Smith <wo...@gmail.com>.
On 10/9/06, Mario Ivankovits <ma...@ops.co.at> wrote:
>
> Hi Bruno!
> > and would something like submitOnKeyPress (including enter) be more
> > general and with broader possibilities?
> Do you think about something which allows to configure which keyPress
> triggers the submit?
> How can such a configuration look like?
>
> 1) triggerKeys
> <s:submitOnKeyPress triggerKeys="#13,A,B,C" />
>
> Where #xx means 'keycode'.
>
>
> 2) triggerCallback
> <s:submitOnKeyPress triggerCallback="anyUserMethod" />
>
> Where anyUserMethod will be a user defined javascript function which has
> to be provided by the user
>
> I'd vote for method 2 as this is less complicated to code.
>
>
> To further "complicate" ;-) things we could also discuss if we further
> abstract the event - something like:
>
> <s:submitOnEvent event="keypress|change|focus|blur" />



I think this component would definitely be worth while. +1 !

Where the default event is "keypress" and for "triggerCallback" the
> default is a method which will trigger on "Enter"
>
>
> Ciao,
> Mario
>
>


-- 
Grant Smith

Re: new component "submitOnEnter"

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi Bruno!
> and would something like submitOnKeyPress (including enter) be more
> general and with broader possibilities?
Do you think about something which allows to configure which keyPress
triggers the submit?
How can such a configuration look like?

1) triggerKeys
<s:submitOnKeyPress triggerKeys="#13,A,B,C" />

Where #xx means 'keycode'.


2) triggerCallback
<s:submitOnKeyPress triggerCallback="anyUserMethod" />

Where anyUserMethod will be a user defined javascript function which has
to be provided by the user

I'd vote for method 2 as this is less complicated to code.


To further "complicate" ;-) things we could also discuss if we further
abstract the event - something like:

<s:submitOnEvent event="keypress|change|focus|blur" />


Where the default event is "keypress" and for "triggerCallback" the
default is a method which will trigger on "Enter"


Ciao,
Mario


Re: new component "submitOnEnter"

Posted by Bruno Aranda <br...@gmail.com>.
and would something like submitOnKeyPress (including enter) be more
general and with broader possibilities?

Cheers,

Bruno

On 10/9/06, Matthias Wessendorf <ma...@apache.org> wrote:
> That is an interesting approach, since sometime topics related to [1]
> and [2] pop up here.
> Also I agree on not using dojo for that, since this would do a
> *vendor* lock for the JS side.
>
> -M
>
> On 10/9/06, Mario Ivankovits <ma...@ops.co.at> wrote:
> > Hi!
> >
> > What do you think about a new component which aims to do whats described
> > here [1]
> >
> > It should operate in three modes:
> >
> > 1) as a child of an input* component (direct child)
> > In this mode submitOnEnter will add a "onkeypress" handler to the input
> > component and fires the button/link pointed to with "for"
> >
> > 2) standalone somewhere on the page
> > In this mode submitOnEnter will intercept *all* keystrokes and fires the
> > button/link pointed to with "for"
> >
> > 3) as a child of a command* component (link or button)
> > In this mode submitOnEnter will intercept *all* keystrokes and fires the
> > button/link it is embedded.
> >
> > It should handle buttons and links - links as described on [2]
> >
> >
> > The proposed syntax is:
> >
> > <s:submitOnEnter for="myButton" />
> >
> > <h:commandLink .... >
> >     <s:submitOnEnter/>
> > </h:commandLink>
> >
> > Even if for some reasons it might be easier, the component should *not*
> > use dojo.
> >
> >
> > What do you think?
> >
> > Ciao,
> > Mario
> >
> >
> > [1] http://wiki.apache.org/myfaces/SubmitPageOnValueChange
> > [2] http://wiki.apache.org/myfaces/JavascriptWithJavaServerFaces
> >
> >
>
>
> --
> Matthias Wessendorf
> http://tinyurl.com/fmywh
>
> further stuff:
> blog: http://jroller.com/page/mwessendorf
> mail: mwessendorf-at-gmail-dot-com
>

Re: new component "submitOnEnter"

Posted by Matthias Wessendorf <ma...@apache.org>.
That is an interesting approach, since sometime topics related to [1]
and [2] pop up here.
Also I agree on not using dojo for that, since this would do a
*vendor* lock for the JS side.

-M

On 10/9/06, Mario Ivankovits <ma...@ops.co.at> wrote:
> Hi!
>
> What do you think about a new component which aims to do whats described
> here [1]
>
> It should operate in three modes:
>
> 1) as a child of an input* component (direct child)
> In this mode submitOnEnter will add a "onkeypress" handler to the input
> component and fires the button/link pointed to with "for"
>
> 2) standalone somewhere on the page
> In this mode submitOnEnter will intercept *all* keystrokes and fires the
> button/link pointed to with "for"
>
> 3) as a child of a command* component (link or button)
> In this mode submitOnEnter will intercept *all* keystrokes and fires the
> button/link it is embedded.
>
> It should handle buttons and links - links as described on [2]
>
>
> The proposed syntax is:
>
> <s:submitOnEnter for="myButton" />
>
> <h:commandLink .... >
>     <s:submitOnEnter/>
> </h:commandLink>
>
> Even if for some reasons it might be easier, the component should *not*
> use dojo.
>
>
> What do you think?
>
> Ciao,
> Mario
>
>
> [1] http://wiki.apache.org/myfaces/SubmitPageOnValueChange
> [2] http://wiki.apache.org/myfaces/JavascriptWithJavaServerFaces
>
>


-- 
Matthias Wessendorf
http://tinyurl.com/fmywh

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com