Trying to access the wrapper class variable in javascript, but it's not serialized in apex controller. trying to get the value in for loop - mainly for validation purpose.

function validateApplicantInfo(thisvar, AddFields){

  /* Result from AddFields
   [MFF_Fields:[MFF_DateFldvalue=null, MFF_DepFldList=(), 
   MFF_DepPicklistOpts=null, MFF_FieldLabel=Account Name, MFF_FieldName=Name, 
   MFF_FieldOrderNum=0, MFF_FieldType=String, MFF_FieldValue=null....

   Need to loop through the wrapper class variables */

    var records = [];
    records = AddFields.MFF_Fields;
    for(var i = 0;  i< records.size; i++){

       if($("[id$='stringFld']").val() == '' && records[i].MFF_RequiredField == true){
          isError = true;

PS- Wrapper object is not serialized in apex controller


Since it's a global wrapper list you can access it directly in JavaScript. Use <apex:repeat> function in script to loop through the List.

function validateApplicantInfo(thisvar){

  <apex:repeat value="{!MFAddEditFields}" var="local">  
    if($("[id$='stringFld']").val() == '' && {!local.MFF_RequiredField}' == true){  
          isError = true;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.