function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

required="true" option is affecting my VF page behavior.

Hello everyone,

I've been having some problems with an inputField that has the required option set as true. I finally narrowed down the problem to this because once I remove the required option (set it to false) I no longer have the problem.

What i'm trying to do is to call a function in my controller on the onkeyup event in one of my inputFields. Once the onkeyup event happens I send the value of my input to the controller action which returns a set of records.. Everything works fine If I only have one field set as a required field. If I have more than one required fields apparently the value of my input is not being assigned to a variable in my controller.. Any ideas?

Here's a piece of my VF page:

If I remove the required="true" option from Tracking_TFN__c.Phone_Number_Formatted__c InputField, the javascript function calls the controller action and everything works as it should, otherwise It seems that my actionFunction is not performing the assignTo="{!searchInput}" properly

 <apex:outputPanel >
  <apex:form >

   <apex:actionFunction name="saveRecord" action="{!c_save}" rerender="errormessageslu" status="actionstatuslu">
    <apex:param name="saveid" value="" />

    <apex:actionFunction name="searchRelated" action="{!searchRelated}" rerender="clist,ResultsLabel" status="actionstatuslu2">
    <apex:param name="searchString" assignTo="{!searchInput}" value="" />
      <apex:pageBlock id="newform1lu" title="{!sTitle}" mode="edit">
   <apex:pageBlockSection columns="1">
       <apex:outputPanel id="errormessageslu" layout="block" styleClass="searchActionStart">
                <apex:actionStatus startText="Saving..." id="actionstatuslu" />
                 <apex:pageMessages />
         <apex:pageBlockSection title="Information" columns="1">
           <apex:inputField value="{!Tracking_TFN__c.Name}"  id="objname" required="true" onkeyup="searchRelated(this.value);"/>
           add_sonameinput = document.getElementById('{!$Component.objname}');
           if('{!$CurrentPage.parameters.newid}' != ''){
          <apex:inputField value="{!Tracking_TFN__c.Phone_Number_Formatted__c}" required="true"/>
          <apex:inputField value="{!Tracking_TFN__c.TFN_Code__c}" />
          <apex:pageBlockButtons location="top"> 
           <apex:commandButton action="{!avoidRefresh}" rerender="refreshpanel" onclick="add_csave()" value="Save"  />
                    <apex:commandButton action="{!c_savenew}" rerender="errormessageslu" value="Save & New" status="actionstatuslu"/>               
                   <apex:commandButton onclick="window.close();" value="Close" immediate="true" status="actionstatuslu" />

Thanks in advance!
nevermind... to solve this issue I must set immediate="true" option in my actionFunction.