Hi All,

We have a data table (t:datatable) where the user has the ability to select 
only one row. The first column of the datatable is a radio button 
(s:selectOneRow). On selection of the radio button rest of the page is 
refreshed with values if the row selected was previously saved and has values. 
There are validations (numeric field validation, range validation etc..) 
defined on many such fields.

Here is the code for the data table:

<t:dataTable id="table1" preserveDataModel="false" border="0"
                headerClass="TABLE_HEADER" styleClass="LABEL"
                value="#{ppmdController.listLayerOne}" var="ppmdVariation"
                rowIndexVar="row" binding="#{ppmdController.dataTable}">

                <%-- Column for Radio button --%>
                <t:column width="5%">
                                <f:facet name="header">
                                                <t:outputText 
styleClass="TABLE_HEADING_LABEL"
                                                                
value="#{ppmdMessages['LABEL_SELECT']}" />
                                </f:facet>

                                <t:panelGrid columns="2">
                                                <s:selectOneRow 
id="radioLayerOne" groupName="selection"
                                                                
value="#{ppmdController.selectedRow}">
                                                                <f:selectItem 
itemValue="ABC" itemLabel="" id="rad"></f:selectItem>
                                                                <a4j:support 
event="onclick" id="ajaxOne"
                                                                
reRender="Rx_Quantity,id_minQty,id_minDaySupply,Days_Supply,id_strtrDose,id_strtrDoseBypassDays,id_strtrDoseMaintBypassDays,id_maxRetailDays,txtNoMoreThanFills,menuAlwdPerOptn,calStrtDate,chkboxDeductible,chkboxOutOfPkt,chkboxMaxBft,menuMailSrvc,id_CmpQty,selectedProvider,selectedNetwork,selectedClaims,myPpmdfloater"
                                                                                
actionListener="#{ppmdController.fetchLayerTwo}"
                                                                                
oncomplete="Richfaces.hideModalPanel('ajaxLoadingModalBox');enableMaxRxQtyDysSplyPPMD();">
                                                                </a4j:support>
                                                </s:selectOneRow>
                                </t:panelGrid>
                                ...
                                ...

If the user adds a new row by clicking on a "Add" button, then a new row gets 
dynamically added to the data table shown above. This works fine.  The user now 
enters some invalid values for that row in the rest of the page. One toggle as 
seen in the code above, a A4J submit is made. This would mean that fields in 
the rest of the page will be validated as the current row needs to be saved on 
toggle even (implicit save functionality is a requirement).

The requirement is the save the current row and all its associated data on 
toggle. If there is an error then the selected row should be set back to the 
previous selection.

This requirement creates one problem. When there is a validation error then 
none of the action listener or action event will be invoked. The control will 
directly go from validation phase to render response phase. So when there is a 
validation error and the control returns back to the JSP then there are now 2 
radio buttons selected. This is because the model bean never got updated as it 
failed the validation.

We tried using JS to reset the radio button's selected value but we will not be 
able to set any backing bean's property using JS. So that was ruled out.

We also tried to disable the entire data table on error. All the columns get 
disabled but the radio button does not. It still receives focus, so this was 
also ruled out.

What can be a possible solution to avoid more than one radio button to appear 
selected on the UI?
Any help in this regard would be greatly appreciated.

Thanks,
Madhav


**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
for the use of the addressee(s). If you are not the intended recipient, please 
notify the sender by e-mail and delete the original message. Further, you are 
not 
to copy, disclose, or distribute this e-mail or its contents to any other 
person and 
any such actions are unlawful. This e-mail may contain viruses. Infosys has 
taken 
every reasonable precaution to minimize this risk, but is not liable for any 
damage 
you may sustain as a result of any virus in this e-mail. You should carry out 
your 
own virus checks before opening the e-mail or attachment. Infosys reserves the 
right to monitor and review the content of all messages sent to or from this 
e-mail 
address. Messages sent to or from this e-mail address may be stored on the 
Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

Reply via email to