Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you want to do this only in jsf just have to add some AJAX calls. Some suggestions below:</p> <p>Add to all your <code>&lt;h:inputText</code> attribute <code>disabled</code> with value of <code>#{searchSettlementTransRequest.getDisabled('this_component_id')"</code>. So the whole thing will look like this:</p> <pre><code>&lt;h:inputText id="someId1" value="#{searchSettlementTransRequest.someValue}" name="stlmt" disabled="#{searchSettlementTransRequest.getDisabled('someId1')}"/&gt; </code></pre> <p>Next in your bean processing this request change settter for `stlmTransId, pmtTransId, AgentId, AgencyId' that their will mark that this value is being set:</p> <pre><code>public void setXXX(XXX xxx) { // your actual code comes here and at the end set that this component was changed actuallyChanged = id_of_input_text_component_corresponding_to_this_value_as_string; } </code></pre> <p>Of course you have to add field <code>String actuallyChanged</code> to your bean. Method <code>getDisabled(String compId)</code> will know looks:</p> <pre><code>public String getDisabled(String compId) { if (actuallyChanged.equals(compId)) { return ""; else { return "disabled"; } } </code></pre> <p>For all your components you have also add AJAX call like this:</p> <pre><code>&lt;f:ajax event="change" execute="@this" render="stlID pmtID AgentID AgencyID"/&gt; </code></pre> <p>So know when value of one component will change all other will be disabled. But there is immposible to make them enabled after call is make because without cliend side scripting you cannot easly make them available on select or focus gained or anything.</p> <p>If you like to disable components temporary, for example when user type in one component other all disabled, but when he select some of them then this one selected is enabled and all other, included this in which he firstly write text, will be disable. In that case better aproach is to use client side scripting for this, JavaScript for example. </p> <p>Update to exactly match your problem in JavaScript (jQuery)</p> <p>add to all components an event like this: </p> <pre><code>onkeyup="$('#thisComponentId').attr('disabled', false); $('#otherComponentId').attr('disabled', true); $('#otherComponentId').attr('disabled', true); " </code></pre> <p><strong>After your comment you can change it to: </strong></p> <pre><code>onkeyup="if ($('#thisComponentId').val() &amp;&amp; $('#thisComponentId').val() == '') { // here set enable for all components } else { // here set disable for all other components } </code></pre> <p>This isn't very sophisticated way but it should work. Know when you start typing in one component other will be disabled but when you send request all will be enabled again.</p> <p>I hope my explanation will be useful</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload