How to propagate error from custom xbl to main instance ?

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

How to propagate error from custom xbl to main instance ?

ricetrac
Hello,

I read in this post : http://discuss.orbeon.com/Custom-XBL-controls-local-instance-validation-against-custom-type-td4655225.html#a4655238
that we can't propagate validity from the local instance of custom xbl component to the main instance.
But we can show it in the error summary : but how  ?

Thank You for your help.

Julien
Reply | Threaded
Open this post in threaded view
|

Re: How to propagate error from custom xbl to main instance ?

Alessandro  Vernet
Administrator
Julien,

Good question; Form Runner uses events for this, instead of relying on the validity of nodes in instance, for exactly that's reason. You can see how this is done in:

https://github.com/orbeon/orbeon-forms/blob/master/src/resources-packaged/xbl/orbeon/error-summary/error-summary.xbl

Once XBL controls will be able to impact the validity of nodes in the instance, this code will become much, much simpler :).

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: How to propagate error from custom xbl to main instance ?

ricetrac
Sorry, but what i understand, is that the component "error summary" "catch" the event on the main instance, in order to fill the list of error.

But what I would to do is a custom xbl component that validates or not the value entered in the form and see the "xf:alert" in the main list of errors of form.

Do I have to reproduce the component's "error-summary.xbl" in my own component xbl ?

Thank You.

Julien
Reply | Threaded
Open this post in threaded view
|

Re: How to propagate error from custom xbl to main instance ?

Alessandro  Vernet
Administrator
Hi Julien,

Luckily, you don't need to worry about this! A component as simple as this (constraint.xbl) will show its errors in the error summary. Even if it doesn't make the node it is bound to invalid, the xf:input (in inner scope) produces xforms-invalid and xforms-valid event, and those event are caught by the error summary, "by magic", across scope boundaries, thanks to the xxf:phantom="true" on the handler in the error summary. But again, you don't need to worry about all this in your implementation, and I just mention it here in case you're curious.

http://wiki.orbeon.com/forms/doc/developer-guide/xforms-events#TOC-Phantom-handlers

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: How to propagate error from custom xbl to main instance ?

ricetrac
This post was updated on .
Thank You for your response.
I try to understand how it works, but it's still not very clear yet.

I try with this custom xbl (tel.xbl) :

- The initial value of the page is copied in the instance of my custom xbl
- the new value of the input is copied in the main instance
- the error is propagated on the Error summary of the main page

But, the main instance still valid when the input of the custom xbl is invalid. How can I propagate this "status" ?

Thank You.

Julien
Reply | Threaded
Open this post in threaded view
|

Re: How to propagate error from custom xbl to main instance ?

Alessandro  Vernet
Administrator
Hi Julien,

When you have an XBL component, the validity is not propagated to the node of your form instance (fr-form-instance). Instead, it is node in the component that is invalid, and since you have a control bound to that node, there is an xforms-invalid event dispatched, which gets caught by the error summary. Does this make more sense?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: How to propagate error from custom xbl to main instance ?

ricetrac
Hi Alex,

I understood that.

But is there any solution to make the main instance also invalid ?

Thank You.

Julien

-----Message d'origine-----
De : [hidden email] [mailto:[hidden email]] De la part de Alessandro Vernet
Envoyé : mercredi 15 mai 2013 07:34
À : [hidden email]
Objet : [orbeon] Re: How to propagate error from custom xbl to main instance ?

Hi Julien,

When you have an XBL component, the validity is not propagated to the node of your form instance (fr-form-instance). Instead, it is node in the component that is invalid, and since you have a control bound to that node, there is an xforms-invalid event dispatched, which gets caught by the error summary. Does this make more sense?

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
View this message in context: http://discuss.orbeon.com/How-to-propagate-error-from-custom-xbl-to-main-instance-tp4656738p4656771.html
Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].



--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].


Reply | Threaded
Open this post in threaded view
|

Re: How to propagate error from custom xbl to main instance ?

Alessandro  Vernet
Administrator
Hi Julien,

Not at this point, but it shouldn't really matter to you, as long as the error is displayed in the error summary, and users are prevented form saving/submitting when the form is invalid, right?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: How to propagate error from custom xbl to main instance ?

ricetrac
The error is displayed, but the form still valid and the user can submit it, because the main instance is valid.



Cordialement,
Julien Bittard

Le 15 mai 2013 à 20:34, "Alessandro Vernet" <[hidden email]> a écrit :

> Hi Julien,
>
> Not at this point, but it shouldn't really matter to you, as long as the
> error is displayed in the error summary, and users are prevented form
> saving/submitting when the form is invalid, right?
>
> Alex
>
> -----
> --
> Follow Orbeon on Twitter: @orbeon
> Follow me on Twitter: @avernet
> --
> View this message in context: http://discuss.orbeon.com/How-to-propagate-error-from-custom-xbl-to-main-instance-tp4656738p4656779.html
> Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.
>
> --
> You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
>
>

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].


Reply | Threaded
Open this post in threaded view
|

Re: How to propagate error from custom xbl to main instance ?

Alessandro  Vernet
Administrator
Julien,

It shouldn't happen, at least with 4.x. What version of Orbeon Forms is this with? And are you using the standard save or submit button, or did you create your own?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: How to propagate error from custom xbl to main instance ?

ricetrac
Hello,

It's with orbeon 4.1 (tomcat 5.5, jdk 1.6).
But we use our own button :

Send submission :

<xf:secret ref="/form/connexion/password" id="password" xxf:autocomplete="off" class="logon" xxf:size="10" xxf:maxlength="20" tabindex="2">
        <xf:alert>Vous devez saisir un mot de passe</xf:alert>
        <xf:action ev:event="DOMActivate">
                <xf:setvalue ref="/form/action">Valider</xf:setvalue>
                <xf:send submission="Valider"/>
        </xf:action>
</xf:secret>


Submission on the model :
<xf:submission id="Valider"   action="/extranet/interne" method="post" replace="all"/>


Thank You.


Julien


-----Message d'origine-----
De : [hidden email] [mailto:[hidden email]] De la part de Alessandro Vernet
Envoyé : vendredi 17 mai 2013 00:50
À : [hidden email]
Objet : [orbeon] Re: How to propagate error from custom xbl to main instance ?

Julien,

It shouldn't happen, at least with 4.x. What version of Orbeon Forms is this with? And are you using the standard save or submit button, or did you create your own?

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
View this message in context: http://discuss.orbeon.com/How-to-propagate-error-from-custom-xbl-to-main-instance-tp4656738p4656790.html
Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].



--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].


Reply | Threaded
Open this post in threaded view
|

Re: How to propagate error from custom xbl to main instance ?

Alessandro  Vernet
Administrator
Julien,

Got it: just running a submission will not do everything the save button is doing. You can see what the "save" is doing looking at this property:

https://github.com/orbeon/orbeon-forms/blob/4.2-ce/src/resources-packaged/config/properties-form-runner.xml#L187

The action you see listed there are implemented in:

https://github.com/orbeon/orbeon-forms/blob/4.2-ce/src/main/scala/org/orbeon/oxf/fr/SimpleProcess.scala#L285

And documented on:

https://github.com/orbeon/orbeon-forms/wiki/Form-Runner:-Buttons-and-Processes

It would be a shame if you had to replicate all that logic in your own code. Instead you can run a process from your XForms, as done in:

https://github.com/orbeon/orbeon-forms/blob/4.2-ce/src/resources/apps/fr/components/buttons.xsl#L59

You will let us know if this works for you,

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: How to propagate error from custom xbl to main instance ?

Erik Bruchez
Administrator
BTW the lightweight processes are in 4.2, coming out very soon now.

-Erik

On Tue, May 28, 2013 at 3:42 PM, Alessandro  Vernet <[hidden email]> wrote:

> Julien,
>
> Got it: just running a submission will not do everything the save button is
> doing. You can see what the "save" is doing looking at this property:
>
> https://github.com/orbeon/orbeon-forms/blob/4.2-ce/src/resources-packaged/config/properties-form-runner.xml#L187
>
> The action you see listed there are implemented in:
>
> https://github.com/orbeon/orbeon-forms/blob/4.2-ce/src/main/scala/org/orbeon/oxf/fr/SimpleProcess.scala#L285
>
> And documented on:
>
> https://github.com/orbeon/orbeon-forms/wiki/Form-Runner:-Buttons-and-Processes
>
> It would be a shame if you had to replicate all that logic in your own code.
> Instead you can run a process from your XForms, as done in:
>
> https://github.com/orbeon/orbeon-forms/blob/4.2-ce/src/resources/apps/fr/components/buttons.xsl#L59
>
> You will let us know if this works for you,
>
> Alex
>
> -----
> --
> Follow Orbeon on Twitter: @orbeon
> Follow me on Twitter: @avernet
> --
> View this message in context: http://discuss.orbeon.com/How-to-propagate-error-from-custom-xbl-to-main-instance-tp4656738p4656826.html
> Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.
>
> --
> You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
>
>

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].


Reply | Threaded
Open this post in threaded view
|

Re: How to propagate error from custom xbl to main instance ?

ricetrac
In reply to this post by Alessandro Vernet
Hello,

I don't understand how to use it when we write our own forms, without using the Form Builder ?

I try the 4.2, and I try to customize the modal when there is a "xforms-upload-error" : I don't want to display : " There was an error during the upload"

I guess it is the same mechanism ?

Thank you.

Julien


-----Message d'origine-----
De : [hidden email] [mailto:[hidden email]] De la part de Alessandro Vernet
Envoyé : mercredi 29 mai 2013 00:42
À : [hidden email]
Objet : [orbeon] Re: How to propagate error from custom xbl to main instance ?

Julien,

Got it: just running a submission will not do everything the save button is doing. You can see what the "save" is doing looking at this property:

https://github.com/orbeon/orbeon-forms/blob/4.2-ce/src/resources-packaged/config/properties-form-runner.xml#L187

The action you see listed there are implemented in:

https://github.com/orbeon/orbeon-forms/blob/4.2-ce/src/main/scala/org/orbeon/oxf/fr/SimpleProcess.scala#L285

And documented on:

https://github.com/orbeon/orbeon-forms/wiki/Form-Runner:-Buttons-and-Processes

It would be a shame if you had to replicate all that logic in your own code.
Instead you can run a process from your XForms, as done in:

https://github.com/orbeon/orbeon-forms/blob/4.2-ce/src/resources/apps/fr/components/buttons.xsl#L59

You will let us know if this works for you,

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
View this message in context: http://discuss.orbeon.com/How-to-propagate-error-from-custom-xbl-to-main-instance-tp4656738p4656826.html
Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].



--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].


Reply | Threaded
Open this post in threaded view
|

Re: How to propagate error from custom xbl to main instance ?

Alessandro  Vernet
Administrator
Hi Julien,

Correct. The event is xxforms-upload-error, and you'll want to add ev:defaultAction="cancel" on the event handler to prevent the default behavior, which is to show that error message you mentioned. You can see how Form Runner does this here:

https://github.com/orbeon/orbeon-forms/blob/4.2-ce/src/resources/apps/fr/components/view.xsl#L411

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet