Disable adding xform-visited for specific element - orbeon

Is it possible to unbind event for adding xforms-visited class to specific element of form?
I have one collapsible section (initially closed) with only one paragraph and I need it to remain closed after validation, but it gets xforms-visited and fr-section-open classes if something on form doesn't pass validation. Maybe it could be also related to binding opening sections if data on form is invalid.
FYI - I'm using Orbeon 2016.3 version

Orbeon Forms 2018.1 and newer only expands sections that contains errors. This is done with the new expand-invalid action.
Until Orbeon Forms 2017.2, all the sections expand when an error is encountered.

Related

Rendering a extended datatable on selection change of another extended datatable

Q1 :I'm trying to render a rich:extendedDataTable(say Table-B) on 'selectionchange' event of another rich:extendedDatatable(say Table-A). The rendering part is fine. But the style class 'rf-edt-r-sel'(which is used to highlight a selected row) is not removed from the original row in Table-A (where the ajax request was triggered ),even after selecting a different row in Table-A.
Also, This problem is not reproduced when the list associated for Table-B is null in the Managed bean. What should be done to solve this issue?
Q2: When Table-B is rendered with a not-null list, I perform a row selection on Table-B which triggers an Ajax call to the Managed Bean. But after the completion of the ajax request,I'm not able to trigger ajax calls from Table-A on its row selection. What is the problem here ?
There was a problem with the rich faces jar. I was earlier using rich faces 4.0 jars. I replaced all rich faces jars with rich faces 4.3.4 jars. The tables work fine now.

Primefaces, captcha and FacesMessage

I have integrated reCaptcha component in my JSF view (Primefaces) and I want to gather reCaptcha fails errors (blank or error values).
I have to use <p:messages/> component with for attribute because I have many <p:messages/> components (1 for tab in <p:tabView/> component) but when I define id attribute in my <p:captcha/> component and use that id in the for attribute of the <p:messages/>, it doesn't work. When I don't use for attribute to test, I see FacesMessage like :
j_idt16:j_idt69 : bla bla bla...
but j_idt16:j_idt69 id doesn't seem to exist in my generated HTML code...
If I use for="j_idt16:j_idt69" it doesn't work too...
So how can I dispatch captcha messages into proper messages component please ?
The Captcha provide by Primefaces didnt work for me. Please follow the following tutorial which solved my captcha problem using JSF 2 /Primefaces.
http://techzone4all.wordpress.com/2012/02/20/integrate-simple-captcha-to-web-project/
To address your specific need, you should define values for the validatorMessage,converterMessage and requiredMessage attributes on the <p:captcha/>, to be able to display user-friendly messages for their respective situations. FYI the <p:captcha/> component is processed during the submit of it's enclosing form, i.e it cannot be attached to a specific component or anything like that.
For clean message display, you should only place the captcha component in a <h:form/> along with other components relevant to the reCaptcha operation.

making unobtrusive validation work when using Select2 ASP.NET MVC

Select boxes converted to Select2, do not automatically integrate with unobtrusive validation mechanism in ASP.NET MVC framework.
For example, on a form which contains a regular select box (marked as required in model definition), submitting the form while no options have been selected in the select box, will cause the border and background of the select box to take a reddish color, and by using #Html.ValidationMessageFor, error messages, if any, can be displayed beside the box. However if the select box is converted to a Select2 component, then none of the mentioned features work any more. Even the validation error message will not show up.
It seems that the reason for even the validation error message not showing, is because Select2 changes the display CSS property of the original select box to none (display:none), and I guess the unobtrusive validation script does not bother generating error messages for invisible fields.
Any ideas / solutions?
This issue isn't really specific to Select2, but rather to the jQuery unobtrusive validator.
You can turn on validation for hidden fields as highlighted in this answer.
$.validator.setDefaults({
ignore: ''
});
As the comments noted, it didn't work inside an anonymous callback function within $(document).ready(). I had to put it at the top level.
I've run into similar issues with the select2 plugin. I don't know exactly which features you're using specifically, but in my experience, when you set an element as a select2 in the document.ready event, the plugin will change some of the element's attributes on the fly (inspect one of the elements after your page has finished loading - oftentimes you'll see the id and class properties are different than what you're seeing when you view source).
It's difficult to offer more without actually seeing the code, but here's a few ideas to get you started:
First off, obviously make sure you have the a link to your select2.css stylesheet in the header.
Then, since you're talking about form submissions, I'd recommend you examine whether or not you're getting a full postback or submitting via AJAX (if you're using jQueryMobile, you're using AJAX unless you override it in the jquerymobile.js file or set a data-ajax="false" in your form attributes). You can just look at the value returned by Request.IsAjaxRequest() for this. Obviously if you're submitting via ajax, you won't hit the document.ready event and the select2 won't initialize properly and you'd need to figure out a way around that. Try refreshing the page after the submit and see if it renders the select2 component.
Then I'd suggest examining the elements and see if they're not behaving like you'd expect because you're actually trying to work with classes that the plugin has reassigned at runtime. You can either just adjust your logic, or you can dig into the select2 code itself and change the behavior - it's actually fairly well-documented what the code is doing, and if you hop on the Google group for select2, Igor is usually pretty quick to follow up with questions.
like this
$('select').on('select2:select', function (evt){
$(this).blur();
});
$('body').on('change', 'select.m-select2', function () {
$(this).blur();
})

JSF : Disable drop down does not set value to backing bean

I have a requirment in which I need to disable a drop down on certain event through JavaScript and then submit the form. The problem is that when the drop down component is disabled the value in the drop down is not set through the backing bean.
I tried to disable the drop down componenet through div and span but it has not worked.
Can anyone suggest how can I submit the value of a disabled compoement to the backing bean?
OR do i really need to idsable that component, I mean how can I achive this using div or span?
Chapter 17.12.1 of the HTML forms specification says the following (emphasis mine)
17.12.1 Disabled controls
...
When set, the disabled attribute has the following effects on an element:
Disabled controls do not receive focus.
Disabled controls are skipped in tabbing navigation.
Disabled controls cannot be successful.
...
Note the last point. In other words, they are never submitted to the server. Thus, the behaviour you're seeing is fully correct and expected as per the HTML forms specification.
To achieve your requirement, you need to disable it after submission.

Two forms submission - one from Menu and one from Body

I am using tiles framework in my application. I have two JSP(body.jsp and menu.jsp) files one is for body and one is for Menu(Left hand side menu). Now i want a single submit button in body which will post the both body and menu data to one action class.
Kindly suggest solution for the above said problem
Thanks in advance.
Either you make the whole page a big form
or you could use JavaScript to collect the values from the other form and set them in hidden fields of the other form as soon as they're entered
or you use JavaScript to construct a URL by collecting the values and don't use forms at all

Resources