Form preview doesn't get request parameters

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

Form preview doesn't get request parameters

pumbosha
Hi,

I have following problem with form preview.
In my xforms code I use get-request-parameter() method:

<xf:action ev:event="xforms-ready" ev:observer="fr-form-model" if="true()">
    <xf:setvalue ref="instance('fr-form-instance')/*/*[name() = 'valueFromGet']"
                                 value="xxf:get-request-parameter('valueFromGet')"/>
</xf:action>

and It works correctly when i launch formRunner: I mean the value of get parameter: 'valueFromGet' is loading do control named: 'valueFromGet'. The problem is appearing when user clicks 'preview'. In that case control 'valueFromGet' is empty. I don't know why get-request-parameter doesn't work in preview mode.

regards,
Tom
Reply | Threaded
Open this post in threaded view
|

Re: Form preview doesn't get request parameters

Aaron Spike
I ran into this behavior recently also. 

The problem appears to live at:

https://github.com/orbeon/orbeon-forms/blob/master/src/resources/forms/orbeon/builder/form/model.xml#L394

Query string parameters simply aren't passed along from the form being edited to the preview. To solve this I think we'd need another function similar to xxf:get-request-parameter that simply returns a copy of the query string. I would imagine something like that should live near:

https://github.com/orbeon/orbeon-forms/blob/master/src/main/scala/org/orbeon/oxf/xforms/function/xxforms/RequestFunction.scala#L43

and also be registered around:

https://github.com/orbeon/orbeon-forms/blob/master/src/main/scala/org/orbeon/oxf/xforms/library/XXFormsIndependentFunctions.scala#L45

Hopefully one of the developers will respond and let us know if this is a reasonable thing to do.

Aaron Spike

On Thursday, November 6, 2014 11:39:35 AM UTC-6, pumbosha wrote:
Hi,

I have following problem with form preview.
In my xforms code I use get-request-parameter() method:

<xf:action ev:event="xforms-ready" ev:observer="fr-form-model" if="true()">
    <xf:setvalue ref="instance('fr-form-instance')/*/*[name() =
'valueFromGet']"
                               
value="xxf:get-request-parameter('valueFromGet')"/>
</xf:action>

and It works correctly when i launch formRunner: I mean the value of get
parameter: 'valueFromGet' is loading do control named: 'valueFromGet'. The
problem is appearing when user clicks 'preview'. In that case control
'valueFromGet' is empty. I don't know why get-request-parameter doesn't work
in preview mode.

regards,
Tom

--
View this message in context: <a href="http://discuss.orbeon.com/Form-preview-doesn-t-get-request-parameters-tp4659191.html" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fdiscuss.orbeon.com%2FForm-preview-doesn-t-get-request-parameters-tp4659191.html\46sa\75D\46sntz\0751\46usg\75AFQjCNF_62foAcWfYQa_X0pF3ZhhuJYFwg';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fdiscuss.orbeon.com%2FForm-preview-doesn-t-get-request-parameters-tp4659191.html\46sa\75D\46sntz\0751\46usg\75AFQjCNF_62foAcWfYQa_X0pF3ZhhuJYFwg';return true;">http://discuss.orbeon.com/Form-preview-doesn-t-get-request-parameters-tp4659191.html
Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.

This electronic communication, including any attached documents, may contain confidential and/or legally privileged information that is intended only for use by the recipient(s) named above. If you have received this communication in error, please notify the sender immediately and delete the communication and any attachments. Views expressed by the author do not necessarily represent those of Martin Luther College.

--
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: Form preview doesn't get request parameters

Aaron Spike
Here's a patch that potentially fixes this issue (only minimally tested).

https://github.com/orbeon/orbeon-forms/pull/1980


This electronic communication, including any attached documents, may contain confidential and/or legally privileged information that is intended only for use by the recipient(s) named above. If you have received this communication in error, please notify the sender immediately and delete the communication and any attachments. Views expressed by the author do not necessarily represent those of Martin Luther College.

--
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: Form preview doesn't get request parameters

pumbosha
I solved this problem by adding if statement to action:

<xf:action ev:event="xforms-ready" ev:observer="fr-form-model" if="xxf:get-request-parameter('valueFromGet')">
    <xf:setvalue ref="instance('fr-form-instance')/*/*[name() = 'valueFromGet']"
                                 value="xxf:get-request-parameter('valueFromGet')"/>
</xf:action>
Reply | Threaded
Open this post in threaded view
|

Re: Form preview doesn't get request parameters

Aaron Spike
In reply to this post by Aaron Spike
A better solution is on the way:

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

This electronic communication, including any attached documents, may contain confidential and/or legally privileged information that is intended only for use by the recipient(s) named above. If you have received this communication in error, please notify the sender immediately and delete the communication and any attachments. Views expressed by the author do not necessarily represent those of Martin Luther College.

--
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].