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
HanumanHanuman 

Unable to upadate the fields form custom edit page

Hi all,

I have created a custom vfpage for edit view for custom object. In that custom vfpage using action support with onchange event I'm showing/hiding the fields based on the picklist value selection. I was unable to update the field values if I edit the record and change the picklist value and filled the data in the related fields and click save then realted fields are not getting updated.

Can anyone help me over here.

Thanks in advance.
LBKLBK
Can you share your code please?
HanumanHanuman
<apex:pageBlockSection title="Text Messaging Opt In" columns="1">
    <table class="message1 Ltbl1">
        <apex:actionRegion >
                <tr>
                    <td align="right">Text Messaging Opt In</td>
                    <td width="28%"><apex:inputField styleClass="RemoveNone" value="{!UnderGradute__c.Text_Messaging_Opt_In__c}" onkeyup="txtopBorderColor()" onkeydown="txtopBorderColor()" taborderhint="319" required="true"><span id="errtmoi" class="errtext" style="float:left"></span>

                     <apex:actionSupport event="onchange" reRender="ajaxrequest1"/>
                     </apex:inputField>

                    </td>
                </tr>
                </apex:actionRegion>
         </table>

</apex:pageBlockSection>
<apex:outputPanel id="ajaxrequest1">
         <script language="javascript">
            $(function() {
                $(".dateFormat").hide();
            });
         </script>
                 <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" />
                  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
                  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
                    <script>
                  $( function() {
                    $( ".datepicker" ).datepicker({
                      yearRange:"-5:+5",
                      changeMonth: true,
                      changeYear: true,
                     onSelect: function() {
                        var present_i = $(this).attr("id");
                        if(present_i=='j_id0:j_id1:j_id4:j_id807:j_id816')
                        {
                            if($("#"+present_i).val()!='')
                            {
                                document.getElementById("errtxdt").innerHTML="";
                            }
                        }
                        else
                        {
                            if($("#j_id0:j_id1:j_id4:j_id819:j_id837").val()!='')
                            {
                                document.getElementById("errsgdt").innerHTML="";
                            }
                        }
                      }
                    });

                    $(function(){
                        $(document).on("cut copy paste",".datepicker",function(e) {
                            e.preventDefault();
                        });
                    });
                  } );
              </script>
              <div class="clear"></div>
            <apex:pageBlockSection rendered="{!UnderGradute__c.Text_Messaging_Opt_In__c=='Yes'}" columns="1">
                <table class="Ltbl1">
                   <apex:outputPanel >                   
                  
                        <tr>
                           <td align="right">Enter your initials</td>

                           <td width="28%"><span class="error_val"></span><apex:inputField value="{!UnderGradute__c.Enter_your_initials__c}" onkeyup="initBorderColor()" onkeydown="initBorderColor()" taborderhint="320" /><span id="errinit" class="errtext" style="float:left"></span></td>
                        </tr>
                     </apex:outputPanel>
                     </table>
    
                  <table class="Rtbl1">
                    <apex:outputPanel >
                        <tr>
                           <td align="right">Date</td>
                           <td><span class="error_val"></span><apex:inputField value="{!UnderGradute__c.Text_opt_Date__c}" html-class="datepicker" onkeyup="txdtBorderColor()" onkeydown="txdtBorderColor()" taborderhint="321"/><span id="errtxdt" class="errtext" style="float:left"></span></td>
                        </tr>
                        
                     </apex:outputPanel>
                 </table>

              </apex:pageBlockSection>

    </apex:outputPanel>
Thanks for the reply,
this is one of the section which I was unable to update when the piclist value is changed form NO to YES then I was unable to update the Enter your Initials and Date field and Unabel to see the date picker when the clicked on date field.