Embedding the Orbeon Form

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

Embedding the Orbeon Form

jrabasilio
hi,

My application embed a orbeon form, and is possible in my application own a
button to validate that form ?
The ideia is the botton outside form have the same behavior to button orbeon
validate

Thanks
João Basilio

--
Sent from: http://discuss.orbeon.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].
Reply | Threaded
Open this post in threaded view
|

Re: Embedding the Orbeon Form

Alessandro  Vernet
Administrator
Hi João,

I would recommend you let Orbeon Forms include a button that does the task
you need (in this case validation, i.e. the `validate` button), hide it with
CSS, and in your own JavaScript triggered by users pressing your button do a
`.click()` on the button produced by Orbeon Forms. You'll let me know if
this works for you.

https://doc.orbeon.com/form-runner/advanced/buttons-and-processes/predefined.html

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.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].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Embedding the Orbeon Form

jrabasilio
Hi Alex,

My application button make more than only validate the form, is runs others
processes, i read others posts and found this examples
https://doc.orbeon.com/form-runner/api/other/run-form-background.html ,
maybe is the solution

if i add this in my properties file
<property as="xs:string"
name="oxf.fr.detail.process.after-data.background.edit.*.*">
    require-valid
</property>


and call POST method, if the response is the result of background execution,
and if a have requerid fields empty the response is false, right ?

<process-success>false</process-success>

I not tested yet my solution because my versions of orbeon is 2017.01

what do you think ? Its work ?

Thanks João


--
Sent from: http://discuss.orbeon.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].
Reply | Threaded
Open this post in threaded view
|

Re: Embedding the Orbeon Form

Alessandro  Vernet
Administrator
Hi João,

That will work if the data has already been saved and you want to check if
the data is valid. But in your case I imagine you have cases where the data
hasn't been saved yet (maybe because it is invalid!), and it seems simpler
to just do as if users clicked on the built-in "Validate" button, doesn't
it? Also, this will show all the errors in the form, even for no-visited
fields.

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.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].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Embedding the Orbeon Form

jrabasilio
Hi Alex,


The Ideia is call the post method only users fill all required fields.
I want when users click in my button and have any error on form the process
is interrupt,  and users need fill fields and save form. Only after that
click again in my button.
My form have data and is saved before they click on my button.

I think the ideia to use background process maybe work

Thanks.
João

--
Sent from: http://discuss.orbeon.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].
Reply | Threaded
Open this post in threaded view
|

Re: Embedding the Orbeon Form

Alessandro  Vernet
Administrator
João, in general, I just prefer avoiding having invalid data saved in the
database, and so if possible I prefer to prevent it, tell users, and then
only save the data once it is valid. But sure, if using a background process
works for you, then it's good. You know your own situation better than me
:).

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.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].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Embedding the Orbeon Form

jrabasilio
Hi Alex,

My orbeon version is the last version,

I define in my properties-local.xml
 <property as="xs:string"
name="oxf.fr.detail.process.after-data.background.edit.*.*">
    xf:setvalue(ref ="//current-time", value = "current-dateTime()") then
save
    then require-valid
 </property>

I have in form one text field with name current-time , when i call
background service the controller is fill with the current date and time ,
fine .
But i have another mandatory text field in blank, and the return for the
service is
<?xml version="1.0" encoding="UTF-8"?><response>
    <document-id>078d193a-bf7d-4832-8ecd-bc0e4b38cf16</document-id>
    <process-success>true</process-success>
</response>

I expected false in result, if i click on "save" on form, the form return
errors, why the background service return true ?

It's my bad interpretation of background service ?

Thanks.
João Basilio





--
Sent from: http://discuss.orbeon.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].
Reply | Threaded
Open this post in threaded view
|

Re: Embedding the Orbeon Form

Alessandro  Vernet
Administrator
Hi João,

Note that you'll want to use `after-controls` instead of `after-data`,
because you want your process to run when the controls are "live", so
validation errors on those controls can be caught.

But with `after-controls` I would indeed expect the result to be
`<process-success>false</process-success>`. I'll look more closely into it,
and follow-up on this here.

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.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].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Embedding the Orbeon Form

jrabasilio
Alex ,

I change the 'after-data' to 'after-controls' but the result is the same,
process return true when have mandatory fields in blank.


 My configurations is
 In properties.xml
<property as="xs:string"
name="oxf.fr.detail.process.after-controls.background.edit.*.*">
    xf:setvalue(ref ="//current-time", value = "current-dateTime()")
    then require-valid
    then save
 </property>


my form definition is
form.xml <http://discuss.orbeon.com/file/t375602/form.xml>  


thank you for your quick response.
João Basilio

--
Sent from: http://discuss.orbeon.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].
Reply | Threaded
Open this post in threaded view
|

Re: Embedding the Orbeon Form

Alessandro  Vernet
Administrator
Hi João,

Yes, I've created the issue linked below and will let Erik follow-up with
you on this one.

https://github.com/orbeon/orbeon-forms/issues/3546

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.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].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Embedding the Orbeon Form

Erik Bruchez
Administrator
João,

A quick update to mention that the root of the problem has been identified
(see comments in issue #3546). The next step is to implement a fix.

-Erik

--
Sent from: http://discuss.orbeon.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].
Reply | Threaded
Open this post in threaded view
|

Re: Embedding the Orbeon Form

Erik Bruchez
Administrator
João,

It dawned on me that you can just write the following:

    <property as="xs:string"
name="oxf.fr.detail.process.after-controls.background.edit.*.*">
        xf:setvalue(ref ="//current-time", value = "current-dateTime()")
        then validate("error")
        then save
    </property>

The `require-valid` process does more things which are not relevant to the
background processing anyway.

You’ll let us know if this works for you!

Regards,

-Erik

--
Sent from: http://discuss.orbeon.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].