Preguntas sobre los formularios

Re: Preguntas sobre los formularios

de Santiago Nieto Carrera -
Número de respuestas: 0
He estado indagando y puedo utilizar la siguiente sentencia para poder realizar comprobaciones antes de enviar el formulario:
$mform->addRule(array('timelimitmin','timelimit','error tlim min', 'compare','<=');

El problema es que no me reconoce el parámetro timelimit. Este es uno que ya se definió en el quiz por defecto, pero tiene una peculariedad y es que se ha hecho un array y después se creó el elemento en lugar de añadirlo. Pongo el código:

$timelimitgrp=array();
        $timelimitgrp[] = &$mform->createElement('text', 'timelimit');
        $timelimitgrp[] = &$mform->createElement('checkbox', 'timelimitenable', '', get_string('enable'));
        $mform->addGroup($timelimitgrp, 'timelimitgrp', get_string('timelimitmin', 'quiz'), array(' '), false);
        $mform->setType('timelimit', PARAM_TEXT);
        $timelimitgrprules = array();
        $timelimitgrprules['timelimit'][] = array(null, 'numeric', null, 'client');
        $mform->addGroupRule('timelimitgrp', $timelimitgrprules);
        $mform->disabledIf('timelimitgrp', 'timelimitenable');
        $mform->setAdvanced('timelimitgrp', $CFG->quiz_fix_timelimit);
        $mform->setHelpButton('timelimitgrp', array("timelimit", get_string("quiztimer","quiz"), "quiz"));
        $mform->setDefault('timelimit', $CFG->quiz_timelimit);
        $mform->setDefault('timelimitenable', !empty($CFG->quiz_timelimit));

Como puedo hacer para poner que me haga la comparación entre el elemento 'timelimit' y el que yo he definido 'timelimimin'. He comprobado que la sentencia es correcta, ya que si en lugar de 'timelimit' uso 'timelimitmax' si me funciona.