Forums

Event Switcher: Error Message Near Field

jwill 21 Oct, 2016
Bob,

The thread with this subject has been locked but there was never an answer to the last question (attached below) and I have the same question. This is the code I am using:

    <?php
    $valid = true;
    if ((!empty($form->data['cell1']) ) && (empty($form->data['input_radio_10']) ) ) {
     $form->errors[ 'input_radio_10' ] = "Please indicate who uses the 1st Cell Phone"; 
     $valid = false;
    }


It appears like the only reason there is a field name "['input_radio_10']" after "$form->errors" is to indicate what field has the error. But the error message only displays at the top of the page. Server Validations display the error below the field (and at the top if that drop down is on.)

Am I doing something wrong? As the prior poster indicated (message below) "$form->validation_errors ['fied_name'] displayed the error at the field in previous versions of Chronoforms.

Thanks,

Jim

mmm :?

In the old version (v3) I have this code:

             if ($RADIO_CONSENSO_TRATTAMENTO_DATI_PERSONALI == "NO") {
                    $form->validation_errors['RADIO_CONSENSO_TRATTAMENTO_DATI_PERSONALI'] = "Senza il consenso al trattamento dei dati personali non è possibile procedere (hai scelto: $RADIO_CONSENSO_TRATTAMENTO_DATI_PERSONALI).";
                    
                    return false;
                }


in the Custom Server Side Validation.

In the Event Switcher I have a code like this:

                if ($RADIO_CONSENSO_TRATTAMENTO_DATI_PERSONALI == "NO") {
                    $form->errors['RADIO_CONSENSO_TRATTAMENTO_DATI_PERSONALI'] = "Senza il consenso al trattamento dei dati personali non è possibile procedere (hai scelto: $RADIO_CONSENSO_TRATTAMENTO_DATI_PERSONALI).";
                    
                    return "fail";
                }


when the difference is container, method ("errors" rather than "validation_errors") and return value ("fail" rather than false).

But in the v3 the message is displayed correctly, near the field.

Is not possible in v5 ?

This topic is locked and no more replies can be posted.