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
maddy27maddy27 

How to hold the value in field on visual force page?

I have business requirement for for validating email address and confirm email address.
I used jquery to validate both the fields and created confirmEmail adress on wrapper class.
There are 2 applicants in one page, it is working correctly for applicant 1 but when i move to tab applicant 2, confirm email value disappears.
Please help.
Thanks
 
<div class="{!if($site.Name!='Aussie', 'span12', 'span6')} removelmargin lfsTextInputXLge input100pct">
                    <label class="removelmargin labeldark">Email address</label><br />
                    <apex:inputText value="{!applicantWrapper.applicant.Email_Address__c}" onfocus="checkPhoneNumbersOnEmail()" id="Applicant__c___Email_Address__c"
                                    html-onpaste="return false;"
                                    styleClass="input-block-level isMaxLength40 marginbottom10 {!IF(applicantNo==2,'isEmail2','isEmail')}  " />
                    <div class="clearfix"></div>
                    <apex:outputText rendered="{!applicantWrapper.errorEmail}" value="{!applicantWrapper.errorEmailMsg}" styleClass="warningMessage" />
                    <apex:outputText rendered="{!brokerchannel}" value="Please make sure to enter customer's email address." styleClass="warningMessage" />
                </div>
              
       
              
               <div class="{!if($site.Name!='Aussie', 'span12', 'span6')} removelmargin lfsTextInputXLge input100pct" id="result" >                   
                    <label class="removelmargin labeldark">Confirm Email address</label><br />
                    <apex:inputText rendered="true"  value="{!applicantWrapper.confirmEmailAddress}"  id="Applicant__c__Confirm_Email_Address__c"  onblur="$j(this).valid();"  
                                    styleClass="input-block-level {!IF(applicantNo==2,'isConfirmEmail2','isConfirmEmail')}"   html-onpaste="return false;"
                                   />
                    <div class="clearfix"></div>
                    <apex:outputText rendered="{!applicantWrapper.errorConfirmEmail}" value="{!applicantWrapper.errorConfirmEmailMsg}" styleClass="warningMessage" />
                </div>

JQuery
 
$j.validator.addMethod("vConfirmEmail", function(value, element, arg){
      var result = false;
      var emailadr = $j(".isEmail").val();
		console.log(emailadr);
        console.log(value);
        if(emailadr ==value ){
            return true;            
        }
    }, "Email addresses do not match - please review and confirm your email address");
    
     //Check email confirmation for applicant 2
     $j.validator.addMethod("vConfirmEmail2", function(value, element) {
        var result = false;
              var emailadr = $j(".isEmail2").val();
                console.log(emailadr);
                console.log(value);
                if(emailadr ==value ){
                    return true;            
                }
            }, "Email addresses do not match - please review and confirm your email address");

​​​​​​​
Deepali KulshresthaDeepali Kulshrestha
Hi maddy27,

I went through the query of yours regarding holding the values in the visual force page and found some links that can assist you in solving your query.
Please refer to the following links as they may be helpful in solving your problem:
https://developer.salesforce.com/forums/?id=9060G000000IBKLQA4
https://developer.salesforce.com/forums/?id=906F000000098ewIAA
https://webkul.com/blog/write-wrapper-class-apex/

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
maddy27maddy27
Thanks Deepali :) 
i used wrapper class and created two properties