Newbie Moodle developer formlib question

Newbie Moodle developer formlib question

by Judy Hsu -
Number of replies: 0

hi,

I'm trying to develop a simple custom report that either take Enrollment date or Post-test date range and return the results... here is a test that I have so far:

    echo '
    <form action="'. $CFG->wwwroot.'/xxx/report.php?id='. $course->id.'">
        <fieldset>
            <table width="100%">
                <tr>
                    <td><label>Course:</label></td>
                    <td><select class="courseid" name="id">'.$options.'</select></td>
                    
                    <td><label>Enrollment date:</label></td>
                    <td><input id="efrom" type="text" name="efrom" placeholder="From" value="'.$efrom.'" /></td>
                    <td><input id="eto" type="text" name="eto" placeholder="To" value="'.$eto.'" /></td>

                    <td><label>Post test date:</label></td>
                    <td><input id="pfrom" type="text" name="pfrom" placeholder="From" value="'.$pfrom.'" /></td>
                    <td><input id="pto" type="text" name="pto" placeholder="To" value="'.$pto.'" /></td>
                    
                    <td><input type="submit" name="submit" value="Submit" /></td>
                    <td><input type="submit" name="output" value="Download" /></td>
                </tr>
            </table>
        </fieldset>
    </form>';

This did work. However, it will NOT prevent users to enter BOTH Enrollment date and Post-test date. I want it to behave in a way that if users specify the Enrollment date, then they can't specify the Post-test date. How do I do that? Also, if I am to use Moodle's formslib to implement this, how would the codes be like? Thanks in advance!

 

Average of ratings: -