Currency set dynamically in form builder

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

Currency set dynamically in form builder

Sachin B
Hi

I have to set currency dynamically in form builder.
Currently I found that the setting currency dynamically with prefix element as below.

<fr:currency ref="value">
    <fr:prefix ref="/config/prefix"/>
</fr:currency>

Can anyone explain me about /config/prefix  this currency ref or any other way .

Please let me know if any idea about this.
Reply | Threaded
Open this post in threaded view
|

Re: Currency set dynamically in form builder

Alessandro  Vernet
Administrator
Hi Sachin,

What goes in the `ref` is an XPath expression returning the prefix to use. For instance, if you have <fr:prefix ref="'CHF'"/>, in this case the expression is 'CHF', that is returns the string "CHF".

And you're saying that the currency is dynamic in your case. Do you know how to write an XPath expression that returns the value you need?

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

Re: Currency set dynamically in form builder

Sachin B
Hi Alex,

I have to set the currency prefix dynamically on server call.
How will it bind with the server call and what are the settings and response required to implement this?

FYI, I have set up the below code in form builder.

<fr:currency ref="value">
  <fr:prefix ref="/config/prefix"/>
</fr:currency>


Sachin B
Reply | Threaded
Open this post in threaded view
|

Re: Currency set dynamically in form builder

Alessandro  Vernet
Administrator
Hi Sachin,

I am not sure to understand what you're trying to do. How do you know what prefix to use on the server? Do you have that value somewhere? In an HTTP header, somewhere else?

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

Re: Currency set dynamically in form builder

Sachin B
Hi Alex,

I want to achieve internationalization for currency. The form will be created from different location. So the currency may be dollar, euro rupees etc.
I have following options-
1)On form load call to server to get currency prefix (i.e $, £ etc)
2)save in global variables at starting

Please let me know how to set currency according to locations dynamically.

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Currency set dynamically in form builder

Alessandro  Vernet
Administrator
Hi Sachin,

It is still unclear to me how you will know which currency symbol to use for a given user. But let's assume you have this information in an HTTP header named `UserCurrencyPrefix` (e.g. set by a servlet filter or reverse proxy), then you would write:

<fr:prefix ref="xxf:get-request-header('UserCurrencyPrefix')"/>

But obviously, the XPath expression to use will depend of where this information comes from, on the server. Does this make sense, or am I missing something?

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