+ Start a Discussion
Brandon COFFINBrandon COFFIN 

Visualforce onchange does not fire when other fields required

Hi,

I have a Visualforce page that has a lookup field and when it changes, I would like to perform an Apex action then rerender another block.

Here is the code I wrote :
<apex:pageBlockTable value="{!generalInformation}" var="information">
            	<apex:column headerValue="{!$ObjectType.Object__c.Fields.Lookup__c.Label}">
                    <apex:inputField id="test" value="{!information.Lookup__c}" required="true">
                        <apex:actionSupport event="onchange" action="{!action}" reRender="table" />
                    </apex:inputField>
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Object__c.Fields.Date__c.Label}">
                	<apex:inputField value="{!information.Date__c}" />
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Object__c.Fields.Single_picklist_one__c.Label}">
                	<apex:inputField value="{!information.Single_picklist_one__c}" />
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Object__c.Fields.Single_picklist_two__c.Label}">
                	<apex:inputField value="{!information.Single_picklist_two__c}" />
                </apex:column>
            </apex:pageBlockTable>

This code works, the onchang fires. But when I set the other fields required like this :
<apex:pageBlockTable value="{!generalInformation}" var="information">
            	<apex:column headerValue="{!$ObjectType.Object__c.Fields.Lookup__c.Label}">
                    <apex:inputField id="test" value="{!information.Lookup__c}" required="true">
                        <apex:actionSupport event="onchange" action="{!action}" reRender="table" />
                    </apex:inputField>
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Object__c.Fields.Date__c.Label}">
                	<apex:inputField value="{!information.Date__c}" required="true" />
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Object__c.Fields.Single_picklist_one__c.Label}">
                	<apex:inputField value="{!information.Single_picklist_one__c}" required="true" />
                </apex:column>
                <apex:column headerValue="{!$ObjectType.Object__c.Fields.Single_picklist_two__c.Label}">
                	<apex:inputField value="{!information.Single_picklist_two__c}" required="true" />
                </apex:column>
            </apex:pageBlockTable>

It stops working.
I tried using imediate="true" and a Javascript function (but maybe it wasn't correct)

Thanks