Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic LHH: simpler way to get typed formatted control value #3772

Open
2 tasks
ebruchez opened this issue Oct 4, 2018 · 0 comments
Open
2 tasks

Dynamic LHH: simpler way to get typed formatted control value #3772

ebruchez opened this issue Oct 4, 2018 · 0 comments

Comments

@ebruchez
Copy link
Collaborator

ebruchez commented Oct 4, 2018

Following #1342.

Say I want to show a date as part of the label, with "Quantity as of {$date}".

Right now, using "Control Value" shows "Quantity as of Tue Oct 02 17:00:00 PDT 2018", because the date doesn't use the appropriate formatting.

I can work around this with a very complicated formula:

format-date(array:get(fr:control-typed-value('date'), 1), '[MNn] [D], [Y]', 'en', (), ())

or:

format-date(xs:date(fr:control-string-value('date')), '[MNn] [D], [Y]', 'en', (), ())

We should:

  • fix the default formatting so we can use "Control Value" in most cases
  • allow getting control values with variables

For variables, $foo should translate to:

let $array := fr:control-typed-value('foo', false())
return
  for $i in (1 to array:size($array))
  return
    array:get($array, $i)

With this, we could do a custom formatting with:

format-date($date, '[MNn] [D], [Y]', 'en', (), ())

Even better, in the big picture, would be to have a custom formatting feature for the parameter in the Form Builder UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Orbeon Forms 2019.1
  
Awaiting triage
Development

No branches or pull requests

1 participant