We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5340
    • 1,624 Posts
    Hi,

    I don’t seem to understand the difference between $vMsg and $rMsg. I know what the manual says but why do both display in the same place?

    It seems they both display one after another after submitting the post
    The following required field(s) are missing: Access Code, firstname Error 1
    firstname Error 2



    <?php
    function reqFields(&$fields, &$vMsg, &$rMsg) {
    	global $modx;
    		
    		if($fields['member'] == 'yes'){
    			if(!$fields['firstname']){
    				$rMsg['firstname'] = "firstname Error";
    				$vMsg['firstname'] = "firstname Error";
    			}
    		}else if($fields['member'] == 'no'){
    			if(!$fields['firstnameE']){
    				$rMsg['firstnameE'] = "firstnameE Error";
    				$vMsg['firstnameE'] = "firstnameE Error";
    			}
    		}else{
    			$rMsg['member'] = "Member Error";
    			return false;
    		}
    
    	return true;
    }
    ?>
    


    Can some explain the difference?

    Thank You
      • 7231
      • 4,205 Posts
      One is the error for the Required fields and the other the error for the Validation. I think that the verification process it will stop at required if it fails while other fields may stop at validation and both errors are displayed together so both need to run. I am guessing tongue
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don&#39;t know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 5340
        • 1,624 Posts
        I guess the difference is this:

        The rMsg will be display as The following required field(s) are missing: rMsg-Values
        The vMsg wil be displayed like a list of values.

        So rMsg values should have values like "First Name"
        The vMsg should have values like "Your First Name has only 1 letter "