You need to sign in to do that
Don't have an account?

Checkbox causes a refrash
Hi
I have a table with the first column being a checkbox.
When checked this checkbox causes a refrash of the page and I want to avoid it.
I'm using the onclick event (with no call to the controller) but when I remove it the check is not saved to the controller and my logic is not working properly.
Need help, This is my code:
<apex:page Controller="SearchCheckedOutBooksController" showHeader="false" Tabstyle="Library_Order__c"> <apex:sectionHeader subtitle="ECI Information Center Portal"/> <style> .activeTab {background-color: #2369FF; color:white; background-image:none} .inactiveTab { background-color: lightgrey; color:black; background-image:none} </style> <apex:tabPanel switchType="client" selectedTab=" tabCard" id="InfoCenterTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab"> <apex:tab label="News" name="News" id="tabnews"> <apex:detail relatedList="false" title="true"/> </apex:tab> <apex:tab label="My Library Card" name="Card" id="tabCard"> <apex:pageBlock title="Search My Library Orders" mode="edit"> <apex:form > <label> Subscriber ID to query </label> <apex:inputText value="{!subscriberId}"/> <apex:commandButton action="{!searchOrders}" value="Search" rerender="orderResults"/> </apex:form> </apex:pageBlock> <!-- The results for each call are handled here. --> <apex:outputPanel layout="block" id="orderResults"> <apex:outputPanel rendered="{!IF(hasError == false,true,false)}"> <apex:pageBlock title="Search Results"> <apex:pageBlockButtons > <apex:form > <apex:commandButton value="Cancel Selected Orders" action="{!cancelOrder}"/> </apex:form> </apex:pageBlockButtons> <apex:pageBlockSection title="Pending Orders"> <apex:form > <apex:pageBlockTable width="50%" value="{!myPendingOrders}" var="entry"> <apex:column headerValue="Select"> <apex:inputCheckbox id="checkedone" value="{!entry.isSelected}" disabled="{!entry.disable}"/> <apex:actionSupport event="onclick" /> </apex:column> <apex:column value="{!entry.order.Name}" headerValue="Order ID"/> <apex:column value="{!entry.order.Type__c}" headerValue="Type"/> <apex:column value="{!entry.order.Status__c}" headerValue="Order Status"/> <apex:column value="{!entry.title}" headerValue="Title"/> <apex:column value="{!entry.order.Order_Date__c}" headerValue="Order Date"/> <apex:column value="{!entry.order.Fulfillment_Date__c}" headerValue="Checkout Date"/> <apex:column value="{!entry.order.Return_By__c}" headerValue="Return By"/> </apex:pageBlockTable> </apex:form> </apex:pageBlockSection> </apex:pageBlock> </apex:outputPanel> </apex:tabPanel> </apex:page>
I suspect things are getting confused as you have several apex:form tags on your page - the advice in the docs is only to have one.
Try putting the whole page into a single form - that should propagate your changes.
All Answers
This is documented behaviour - the Visualforce Developer's Guide has this to say about the actionsupport action attribute:
--- snip ---
If an action is not specified, the page simply refreshes.
--- snip ---
Can you explain a bit more about what you are trying to do? e.g. do you need to update values in the controller in order to redraw part of the page?
I got the same behaviour when I specified an action (I removed it in the code I posted).
In the controller I'm "collecting" all the checked rows executing some APEX code, here the method that does that when an action button is clicked:
If I remove the actionSupport all together the code does not work at all (for some reason the isSelected is not being updated on the controller)
Thanks
I suspect things are getting confused as you have several apex:form tags on your page - the advice in the docs is only to have one.
Try putting the whole page into a single form - that should propagate your changes.
Many thanks
Now it works as expected.
I have another issue going though.
I have three tabs on this tab Panel. When I click on the Search button my tables are being populated but when I click on the Delete Order button along with the action being performed the page is refrashed and the 1st tab is being desplayed (I'm on the 2nd when I do it). Why does it jump to the 1st tab?
Why is the different behavior?
Your search button has a rerender attribute associated with it - the other actions don't so they cause the entire page to be refreshed.
Got it,
Thanks a lot