Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Datetime input in the DefaultForm class
#1
There is a method in the DefaultForm class, generate_date_select, which is used to generate a date selection. However, there is no function to generate date + time inputs. In a plugin I'm working on, I created such a function that uses the "date" and "time" inputs.

require_once MYBB_ROOT . "cgdadmin/inc/class_form.php";

/**
 * Workaround for a method that doesn't exist in the DefaultForm class
 */
class ModifiedForm extends DefaultForm {
    function generate_datetime_field($name, $date="", $time="") {
        return "<input type=\"date\" name=\"" . $name . "_date\" id=\"" . $name . "_date\" value=\"" . $date . "\" />
                <input type=\"time\" id=\"" . $name . "_time\" name=\"" . $name . "_time\" value=\"" . $time . "\"";
    }
}


Could something similar be implemented into MyBB?
Reply
#2
Could be nice as a plugin helper.

Would be nice to implement for the task system and any other place where suitable.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)