Re: Allow xf:setfocus with no @control to set the focus to the event target

John,

Sorry about, that, you are right of course.

This is an issue I would obviously solve with AVTs:

   <setfocus value="{event('target')}"/>

-Erik

On Aug 12, 2008, at 5:13 PM, John Boyer wrote:

>
> Hi Erik,
>
> Actually, I was getting at the fact that your example (in the linked  
> email) uses an XPath in the attribute value of the control attribute.
> So what if someone wants to use the control attribute properly by  
> putting an IDREF in it?
> You would evaluate it as an XPath expression, possibly get a  
> resulting node that happens to contain a string that points to  
> another object.
> Like this:
>
> <data>
>    <x>y</x>
> </data>
>
> ...
>
> <setfocus control="x"/>
>
> ...
>
> <input id="x"> ...
>
> <input id="y"> ...
>
> If you evaluate control as an XPath whose string result gievs you an  
> IDREF, then the focus will go to the second input.
> But correct XForms treats the control attribute as an IDREF, not an  
> XPath, so the focus should go to the first input.
>
> Cheers,
> John M. Boyer, Ph.D.
> Senior Technical Staff Member
> Lotus Forms Architect and Researcher
> Chair, W3C Forms Working Group
> Workplace, Portal and Collaboration Software
> IBM Victoria Software Lab
> E-Mail: boyerj@ca.ibm.com
>
> Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer
> Blog RSS feed: http://www.ibm.com/developerworks/blogs/rss/JohnBoyer?flavor=rssdw
>
>
>
>
> From:
> Erik Bruchez <ebruchez@orbeon.com>
> To:
> "public-forms (new)" <public-forms@w3.org>
> Date:
> 08/12/2008 04:58 PM
> Subject:
> Re: Allow xf:setfocus with no @control to set the focus to the event  
> target
>
>
>
>
>
> A solution would be to return the id if it exists. Then this would
> work for controls that have ids.
>
> -Erik
>
> On Aug 12, 2008, at 4:46 PM, John Boyer wrote:
>
> >
> > Hi Erik,
> >
> > Yes, but the datatype for the control attribute is IDREF.  Something
> > similar would be good though:
> >
> > <setfocus>
> >    <control value="event(blah)"/>
> > </setfocus>
> >
> > Cheers,
> > John M. Boyer, Ph.D.
> > Senior Technical Staff Member
> > Lotus Forms Architect and Researcher
> > Chair, W3C Forms Working Group
> > Workplace, Portal and Collaboration Software
> > IBM Victoria Software Lab
> > E-Mail: boyerj@ca.ibm.com
> >
> > Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer
> > Blog RSS feed: http://www.ibm.com/developerworks/blogs/rss/JohnBoyer?flavor=rssdw
> >
> >
> >
> >
> > From:
> > Erik Bruchez <ebruchez@orbeon.com>
> > To:
> > "public-forms (new)" <public-forms@w3.org>
> > Date:
> > 08/12/2008 03:10 PM
> > Subject:
> > Re: Allow xf:setfocus with no @control to set the focus to the
> > event  target
> >
> >
> >
> >
> >
> > Not a huge fan of it either, hence my reference to the way we do  
> it in
> > our implementation. [1]
> >
> > -Erik
> >
> > [1] http://lists.w3.org/Archives/Public/public-forms/2008Aug/0017.html
> >
> > On Aug 12, 2008, at 2:01 PM, John Boyer wrote:
> >
> > >
> > > I thought the point of the ID magic was exactly so that you didn't
> > > have to think about it.
> > > It just does intelligently what is most likely what the form  
> author
> > > meant.
> > >
> > > Does it really make sense to try to focus the event target?   
> What if
> > > a sequence of actions is grouped together and invoked from  
> multiple
> > > locations using dispatch?
> > >
> > > It seems an odd thing to see <setfocus/> without any indication of
> > > what the focus is being set to.
> > >
> > > -1 from me.
> > >
> > > John M. Boyer, Ph.D.
> > > Senior Technical Staff Member
> > > Lotus Forms Architect and Researcher
> > > Chair, W3C Forms Working Group
> > > Workplace, Portal and Collaboration Software
> > > IBM Victoria Software Lab
> > > E-Mail: boyerj@ca.ibm.com
> > >
> > > Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer
> > > Blog RSS feed: http://www.ibm.com/developerworks/blogs/rss/JohnBoyer?flavor=rssdw
> > >
> > >
> > >
> > >
> > > From:
> > > Ulrich Nicolas Lissé <unl@dreamlab.net>
> > > To:
> > > Mark Birbeck <mark.birbeck@webbackplane.com>
> > > Cc:
> > > public-forms <public-forms@w3.org>
> > > Date:
> > > 08/12/2008 01:04 PM
> > > Subject:
> > > Re: Allow xf:setfocus with no @control to set the focus to the
> > > event  target
> > >
> > >
> > >
> > >
> > >
> > > Mark,
> > >
> > > +1 from me. Makes it easy to set focus within repeats without
> > > needing to
> > > understand id magic.
> > >
> > > Regards,
> > > Uli.
> > >
> > > Mark Birbeck wrote:
> > > > Hello all,
> > > >
> > > > I was just looking something up in the spec, and noticed that if
> > > > @control is omitted from the use of xf:setfocus then nothing
> > > happens.
> > > >
> > > > It occurred to me that omitting @control and defaulting to the
> > event
> > > > target might actually be a useful pattern.
> > > >
> > > > This example is a little contrived, because I've only just  
> thought
> > > of
> > > > the whole thing, but bear with me....
> > > >
> > > > Ordinarily, setting focus on a control when it is invalid  
> could be
> > > > done like this:
> > > >
> > > >   <xf:input id="me" ref="x">
> > > >     <xf:label>X:</xf:label>
> > > >     <xf:setfocus control="me" ev:event="xforms-invalid" />
> > > >   </xf:input>
> > > >
> > > > But that requires naming the control with an @id, and then
> > ensuring
> > > > that the @control value and the control name are in sync. An
> > easier
> > > > and more maintainable way would be:
> > > >
> > > >   <xf:input ref="x">
> > > >     <xf:label>X:</xf:label>
> > > >     <xf:setfocus ev:event="xforms-invalid" />
> > > >   </xf:input>
> > > >
> > > > If people don't like simply omitting @control, an alternative
> > > would be:
> > > >
> > > >   <xf:input ref="x">
> > > >     <xf:label>X:</xf:label>
> > > >     <xf:setfocus control="" ev:event="xforms-invalid" />
> > > >   </xf:input>
> > > >
> > > > Regards,
> > > >
> > > > Mark
> > > >
> > >
> > > --
> > > Ulrich Nicolas Lissé
> > >
> > >
> > >
> > >
> >
> > --
> > Orbeon Forms - Web Forms for the Enterprise Done the Right Way
> > http://www.orbeon.com/
> >
> >
> >
> >
>
> --
> Orbeon Forms - Web Forms for the Enterprise Done the Right Way
> http://www.orbeon.com/
>
>
>
>

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/

Received on Wednesday, 13 August 2008 00:23:11 UTC