How to save custom value in request attribute

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

How to save custom value in request attribute

Dareus_Andrej
Hi All

I am using orbeon version 4.0. I configure it to run on MySQL persistence layer and glassfish.
I need to store addtional value in DB when form builder saves the form.
If I understand it right I just need to pass some custom atribute like in../persistance/mysql/crud.xpl from request (see bold line). 

How can I accomplish this ?... How can I store some value to be filled in /request/new_atribute?...
Also the best would be if this value can be passed to the form builder from outside.


<p:when test="/*/method = 'PUT'">
<p:processor name="oxf:sql">
.
some code
.
<sql:param type="xs:string" select="/request/username"/>,
<sql:param type="xs:string" select="/request/new_atribute"/>,
<sql:param type="xs:string" select="/request/app"/>,
<sql:param type="xs:string" select="/request/form"/>,
.
some code
.
</p:processor>
</p:when>

Thank you for any help

--
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 save custom value in request attribute

Alessandro  Vernet
Administrator
Hi Dareus,

Where would the value come from, originally? I imagine this is not a value users enter in the form, or a value that can be calculated based of those values?

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

Re: How to save custom value in request attribute

Dareus_Andrej
This post was updated on .
Thank you for replay

Yes you are right. I would like to run orbeon in Iframe in our J2EE application  
and that value is stored in HttpSession. I need to pass this value to orbeon form builder and save to database as form is saved. The Same approach is when
the user save data to form.

On Thursday, April 18, 2013 6:37:29 PM UTC+2, Alessandro Vernet wrote:
>
> Hi Dareus,
>
> Where would the value come from, originally? I imagine this is not a value
> users enter in the form, or a value that can be calculated based of those
> values?
>
> Alex
>
> -----
> --
> Follow Orbeon on Twitter: @orbeon
> Follow me on Twitter: @avernet
> --
> View this message in context:
> http://discuss.orbeon.com/How-to-save-custom-value-in-request-attribute-tp4656587p4656594.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 orbeon+unsubscribe@googlegroups.com.
To post to this group, send email to orbeon@googlegroups.com.


Reply | Threaded
Open this post in threaded view
|

Re: How to save custom value in request attribute

Alessandro  Vernet
Administrator
Hi Dareus,

I imagine you're running Orbeon and your app as two separate web apps, so the session isn't shared. In that case, I think the easiest way would be for you would to add a request parameter to the URL you use to load the form in the iframe. I imagine you can set to this parameter to whatever is needed, since you're generating the page with the iframe. Assuming you load a "new" page, the URL would be something like:

http://mysite.com/orbeon/fr/orbeon/bookshelf/new?myparam=value

In the form you create in Form Builder, you add a hidden field (with visibility set to "false()"), with initial value xxf:get-request-parameter('myparam'). This way the value will be saved as part of the form data, and won't be editable by users.

Is this something that could work for you?

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

Re: How to save custom value in request attribute

Dareus_Andrej
This post was updated on .
Hello Alex,

Thank you for your help. I have tried the solution you suggested and was able to store myparam value. But I was only able to store this value, with many attempts, as form data especially xml data. Its bit uncomfortable to parse this xml data to get myparam value. Is there some solution to save this value separately to DB like app or form is saved ? I want to implement this in Form Builder itself (somehow add new parameter, myparam that can be read in myslq/persistance/crud.xpl).

example DB row:  created | last_modified | *myparam* | app | form | ...
 Thanks Dareus Andrej

Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
View this message in context:
http://discuss.orbeon.com/How-to-save-custom-value-in-request-attribute-tp4656587p4656617.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 orbeon+unsubscribe@googlegroups.com.
To post to this group, send email to orbeon@googlegroups.com.


Reply | Threaded
Open this post in threaded view
|

Re: How to save custom value in request attribute

Alessandro  Vernet
Administrator
Hi Dareus,

To pass this as a request parameter, with the latest code (which will be in 4.2, as this code changed after the the 4.1 release), you'd need:

1. Pass the parameter to the persistence layer, in SimpleProcess.scala, in trySaveAttachmentsAndData(), doing something similar to what is done passing the "valid" request parameter.

https://github.com/orbeon/orbeon-forms/blob/master/src/main/scala/org/orbeon/oxf/fr/SimpleProcess.scala

2. Change the implementation of the persistence layer to read the parameter and write it to the database.

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

Re: How to save custom value in request attribute

Dareus_Andrej
Thank you for your help

Andrej

--  
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
View this message in context: http://discuss.orbeon.com/How-to-save-custom-value-in-request-attribute-tp4656587p4656646.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].