we are using Orbeon Forms version 2016.3 on project.
Currently we have to implement structure of questions as it is displayed in the following example on picture.
So those indented additional radio buttons should display only when second option from buttons in first line of indentation is selected. Otherwise, on any other selection they should dissapear.
We already know how to make logic for this behavior, but when it comes to appearence and nesting those radio buttons, we didn't manage to find some good solution then badly styling it in css (not looking nice when you are switching selection).
Is there any trick in Orbeon to nest those questions which should appear on specific selection?
To illustrate this, I've created a prototype form that you can run on Orbeon Forms 2017.2. The idea is pretty simple:
The nested radios only show if the corresponding top radio is selected. This is done in Form Builder with a Visibility formula.
If one top radios is checked, the others are reset. This is done in a custom model, as detailed below.
You reference to the custom model from your properties-local.xml with:
<property
as="xs:anyURI"
name="oxf.fr.detail.model.custom.*.*"
value="oxf:/forms/resources/my-model.xml"/>
And add a WEB-INF/resources/forms/resources/my-model.xml with:
<xf:model xmlns:xf="http://www.w3.org/2002/xforms">
<xf:action event="xforms-select" observer="top-1-control top-2-control">
<xf:setvalue iterate="instance()/section-1/(top-1, top-2)" ref="."/>
</xf:action>
</xf:model>
Related
In Vaadin 8's grid you would see the Save/Cancel button when doubleclicking on a row in GridPro. In Vaadin 14 Grid Pro doesn't seem to have that save save/cancel button by default. Is there a way to enable it?
It seems like it should be possible because we have getEditor().addSaveListener() etc.
As an extra question whenever I do any action in the grid it seems to only call the addCancelListener(). Is there a reason for this? The primary question of course is if it's possible to show the save/cancel buttons in GridPro
GridPro adds another editing functionality to the Grid, which is not using grid.getEditor() at all. So these are not to be mixed.
GridPro is designed for cell-based spreadsheet like editing with improved keyboard navigation, thus save/cancel buttons are not there. Editable columns are added using grid.addEditColumn(..) method and using either built in fields like below, or custom type. In both cases saving of the value is handled in the call back provided.
grid.addEditColumn(Person::getEmail)
.text((item, newValue) ->
item.setEmail(newValue))
.setHeader("Email (editable)");
So save / cancel events from grid's editor are not emitted. Also this functionality does not use Binder by default. You need wire Binder yourself if you need it, see example in Vaadin's cookbook.
Basic Grid has builtin row based editor, which uses also Binder. With that one you can use it Binder and editor in buffered mode, and for example add an additional component column to where you have edit / cancel buttons, what ever you like. There is rather good code example at Vaadin's component pages.
In summary there are two different editing facilities provided and these are not to be mixed.
We faced several limitations when creating form using form builder:
When I drag an UI control into a grid cell, the UI control's label and the UI control itself are top down aligned. How to make both aligned at the same row (side by side). I could only figure out the way to do this by using bootstrap CSS.
When we started to customize the form with CSS more & more due to the form builder limitation, the form designer no longer show the exact form output. This trouble us as we need to test/publish the form to view actual output which defeat the purpose of WYSIWYG editor.
for the time component, is there any option to prefix zero in front of selected hour?
Appreciate anyone can help on this.
Note:
I am using orbeon forms 2016.2 for the form development.
I'm writing my custom control (XBL) and wondering : it possible to have checkboxes inside control's Basic Settings in Form Builder, not only xf:input fields ?
I would appreciate any examples.
Currently support for xf:input is hardcoded. You can see how this is implemented here .
It wouldn't be too hard to add support for other controls. Another idea would be to use xxf:dynamic, in effect creating a little subform, so that we don't have to interpret the XForms by hand.
Basically I have 4 tiles,Header,Content,Left and Right.
When i try to display a table inside a form ,for arranging form elements,My whole structure of the master page is being changed.
Initially the structure which i have defined in the master page ie base layout is being changed and table is being deformed when i create a table inside a form in some middle page. Why is this happening?
I have arranged the and other tiles using a table.
Thanks in advance
which theme you are using in struts2?default theme tend to create some markup while rendering the view so that might causes an issue.you can go ahead with simple theme.
by default it is xhtml and you an switch themes per page basis or for entire application
here are the details
Struts2 Themes
Try using the simple theme on your form:
<s:form action="youraction" method="post" name="yourform" theme="simple">
...
</s:form>
ok.
I have a form that (amongst other things) contains 2 multi-select listboxes. Basically you can add items to the one on the right from the full list of items on the left using some add/remove buttons.
The problem is that I cannot see a way of picking up the contents of the listbox when posting back to the controller.
I have followed this example:
http://ittecture.wordpress.com/2009/04/30/tip-of-the-day-198-asp-net-mvc-listbox-controls/
This works fine if you have actually selected the items in the listbox before posting. That's not really the way I think this UI should behave though.
Hope that makes sense,
Nick
Thanks for the help guys. I forgot to mention that I am populating the selected items listbox with jQuery. Not sure if that was important or not though.
In the end, I fixed it by selecting all items onclick with jQuery before posting. Seemed like the easiest solution.
I don't think a listbox is the control you want for the control on the right. The way a listbox works (by posting the selected item) is not what you're trying to achieve.
You could consider having a grid or even just a div with a number of strings. There is more Javascript/JQuery to be written, but it will provide a nice user experience because no postbacks will be needed until all the work is complete.
You'll need to use JavaScript/JQuery to add and remove items from the div based on the buttons to add and remove.
In addition, for each item that is added on the right, you'll need to add a hidden input field:
<input type="hidden" id="SelectedItems" value="..." />
Set the value to the key or id of the newly added item. If you remove a field from the right control, make sure you remove the associated hidden field.
To handle items on the right that the user has removed, you'll need hidden fields to indicate which have been removed:
<input type="hidden" id="RemovedItems" value="..." />
Then in your controller you can add two parameters to the Action (or add two field to the viewmodel) which will be arrays of strings. This will be set to all of the values in the hidden fields that were added, and all the ones that were removed.
In addition to listbox, have several hidden input fields to hold "currently added" items. The listbox selection will indicate "items to remove" when selected.
OK, clarification. You have left and right listboxes. Left one holds available items, and selected ones are POSTed and then added. Right one holds currently added items, and selected ones are POSTed and then removed from added items.
Now, you also need to hold currently added items. You can do this via bunch of
<input type="hidden" name="currently_added" value="itemid" />
hidden fields.
Yes you can go jQuery but this is an easy way; not every site should be designed to require JavaScript turned on. The above solution works without JavaScript enabled.
Your post from page will give you 3 arrays:
Left side box selected items to add
Right side box selected items to remove
Hidden fields - already added items
You take (3), remove (2) from it, add (1) to it, and display the same page or do whatever you want.