dynamic xf:message

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

dynamic xf:message

daniele ippoliti
Hello
I would like to personalize the pop up shown at the moment of a submission failed because I can have mainly 2 types of error:

1) Validation Error (it's ok to have submission failed)
2)Server Error (for operation not allowed for example)

I have an architecture with

User Interface  (to menage files) ----  Alfresco (with the repository and the interface to do some operation on the file) ---- Xform (to generate the UI)

so I have an xf:submission that call in the action attribute e service of alfresco to check if it's possible for example to modify a file or there is already a user that has the lock of the file. If this user can't the server generate an error that generate a submission failed and at this point instead to show just "Submission failed" like for the others error of validation,  I would like to show "modify not allowed" or "creation not allowed"....

Do you have some Idea on how to solve my problem?

I would like to show dynamically different messages dependent on the error happened on server side.
Is it possible to do it.


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: dynamic xf:message

Erik Bruchez
Administrator
Daniele,

Is this with Form Runner or plain XForms? I assume plain XForms.

You can certainly do something like this. The xforms-submit-error
event dispatched to the submission has an error-type property which
you can retrieve with event('error-type'). This indicates
'validation-error' if there is a validation error, etc. See the spec
here:

http://www.w3.org/TR/xforms/#submit-evt-submit-error

So you would do something like:

<xforms:setvalue if="event('error-type') = 'validation-error'"
ref="where you message is">Validation error message</xforms:setvalue>
<xforms:setvalue if="event('error-type') != 'validation-error'"
ref="where you message is">OTHER error message</xforms:setvalue>

Or something along those lines.

-Erik

On Fri, Oct 28, 2011 at 6:22 AM, daniele ippoliti <[hidden email]> wrote:

> Hello
> I would like to personalize the pop up shown at the moment of a submission
> failed because I can have mainly 2 types of error:
>
> 1) Validation Error (it's ok to have submission failed)
> 2)Server Error (for operation not allowed for example)
>
> I have an architecture with
>
> User Interface  (to menage files) ----  Alfresco (with the repository and
> the interface to do some operation on the file) ---- Xform (to generate the
> UI)
>
> so I have an xf:submission that call in the action attribute e service of
> alfresco to check if it's possible for example to modify a file or there is
> already a user that has the lock of the file. If this user can't the server
> generate an error that generate a submission failed and at this point
> instead to show just "Submission failed" like for the others error of
> validation,  I would like to show "modify not allowed" or "creation not
> allowed"....
>
> Do you have some Idea on how to solve my problem?
>
> I would like to show dynamically different messages dependent on the error
> happened on server side.
> Is it possible to do it.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing
> list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws