W3C home > Mailing lists > Public > www-forms@w3.org > December 2006

Re: readonly inputs when form is submitted

From: Iņaki Salinas Bueno <inksalinas@gmail.com>
Date: Wed, 6 Dec 2006 17:28:15 +0100
Message-ID: <cd3c31800612060828s4cb7062ekb4221ad83ea52503@mail.gmail.com>
To: "Klotz, Leigh" <Leigh.Klotz@xerox.com>
Cc: "Rafael Benito" <rbenito@satec.es>, www-forms <www-forms@w3.org>
Lot of thanks Leigh for your clear explanation.

Between this options, I prefer to model the state of the form in the
instance data, and with the post-submission event "xforms-submit-done". I
think it would be better with the ev:event="xforms-submit" you propose but I
should listen to xforms-submit-error in this case, as you say, and I don't
want to arrive to this level of complexity yet.

Thank you

Iņaki

2006/12/5, Klotz, Leigh <Leigh.Klotz@xerox.com>:
>
>  1. Your form has state, and the state can be modelled in the instance or
> in the UI.
>
> - If you are modelling it in the instance data, using an additional
> instance is perfect for this situation, because you don't have a need to
> submit that state flag along with the data.
> - If you are modeling it in the UI, then you can use switch and toggle,
> and you can write two separate pieces of UI to show the pre-submission and
> post-submission states; that way you can change not just whether the fields
> are inputs or outputs, but you can add or subtract other presentation
> information at the same time.
> Whichever of these options works best for you is the one you should chose
> :-)
>
> 2. The state can be changed on the basis of events.  Rafael suggest the
> xforms-submit event, but I wanted to point out there is a second choice.
> This choice is orthogonal to the above choice, because whichever event you
> listen to, you can do setvalue or toggle.
> My suggestion for ev:event="xforms-submit" doesn't Rafael suggested
> changing the flag with an action handler inside submission listening to
> ev:event="xforms-submit-done".
> That will cause the instance data nodes to become readonly when the
> response comes back from the server.
> If you want to have the instance data nodes become readonly when the user
> presses the submit button, but before the response comes back, use an action
> handler inside submission listening tev:event="xforms-submit".
>
>  So there are 4 possibilities: 2 events and 2 actions.  Choose 1 of those
> 4.
>
> Additionally, if you listen on xforms-submit, you should probably also
> listen on xforms-submit-error, though in XForms 1.0 there isn't much help
> for you in deciding what to do.
> If it turns out you need anomalous condition handling (i.e., your server
> didn't like the response), return a 200 and instance data containing data
> describing the condition, and use xf:group bound to those nodes to display
> the anomalous conditions.  Returning codes other than 200 leaves the user
> with few options, at least in XForms 1.0.  If you need more help in this
> area, please respond to the list.
>
> Leigh.
>
>  ------------------------------
> *From:* Iņaki Salinas Bueno [mailto:inksalinas@gmail.com]
> *Sent:* Tuesday, December 05, 2006 10:51 AM
> *To:* Klotz, Leigh
> *Cc:* Rafael Benito; www-forms
> *Subject:* Re: readonly inputs when form is submitted
>
> So far I have solved it introducing an element, as says Rafael (thanks),
> although have introduced the element in a new instance because I did not
> want to corrupt the useful instance with an auxiliary element.
>
> I would like to know the way to do it directly, without intermediate
> elements. It seems that the option that Leigh says is direct, but I don't
> understand it:
>
> Or on ev:event="xforms-submit" inside submission, so it will change before
> the submit happens instead of afterwards.
>
> Is it a new option or is it an adding to the option commented by Rafael?
>
>
> Another option is a switch, with a toggle on xforms-submit inside the
> submission, using a different presentation UI (such as a bunch of outputs)
> inside the second case of the switch.
>
> It consists of having a twin set of outputs, but bound to the attribute
> readonly=true, visible based on switch?
>
> Thank you
>
> Iņaki
>
>
> 2006/12/5, Klotz, Leigh <Leigh.Klotz@xerox.com>:
> >
> >  Or on ev:event="xforms-submit" inside submission, so it will change
> > before the submit happens instead of afterwards.
> >
> > Another option is a switch, with a toggle on xforms-submit inside the
> > submission, using a different presentation UI (such as a bunch of outputs)
> > inside the second case of the switch.
> >
> > Leigh.
> >
> >  ------------------------------
> > *From:* www-forms-request@w3.org [mailto:www-forms-request@w3.org] *On
> > Behalf Of *Rafael Benito
> > *Sent:* Monday, December 04, 2006 2:10 AM
> > *To:* 'Iņaki Salinas Bueno'; 'www-forms'
> > *Subject:* RE: readonly inputs when form is submitted
> >
> >  Iņaki,
> >
> > A way to do it is to set the XPath expression of the @readonly to an
> > auxiliary data model element with the value false prior to the submission.
> > As the submission is done, you can set an action handler setvalue for the
> > xforms-submit-done and set the auxiliary data model element to true. So the
> > inputs will now be resdonly.
> >
> > I hope this helps...
> >
> > Regards,
> >
> > Rafael Benito
> >
> >  ------------------------------
> > *De:* www-forms-request@w3.org [mailto:www-forms-request@w3.org] *En
> > nombre de *Iņaki Salinas Bueno
> > *Enviado el:* viernes, 01 de diciembre de 2006 10:35
> > *Para:* www-forms
> > *Asunto:* readonly inputs when form is submitted
> >
> > I would like to turn inputs to readonly when the form related with its
> > is submitted.
> >
> > I don't know how can I do it. I try with events but @readonly attribute
> > works with xpath, not with events, it is not thus?
> >
> > How can I bind @readonly with a trigger, an action or a event?
> >
> > Thank you
> > Iņaki
> >
> >
>
Received on Wednesday, 6 December 2006 16:28:28 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:08 GMT