Classes

File builder/form/field/FormField.class.php

File builder/form/field/FormField.class.php

  1:   2:   3:   4:   5:   6:   7:   8:   9:  10:  11:  12:  13:  14:  15:  16:  17:  18:  19:  20:  21:  22:  23:  24:  25:  26:  27:  28:  29:  30:  31:  32:  33:  34:  35:  36:  37:  38:  39:  40:  41:  42:  43:  44:  45:  46:  47:  48:  49:  50:  51:  52:  53:  54:  55:  56:  57:  58:  59:  60:  61:  62:  63:  64:  65:  66:  67:  68:  69:  70:  71:  72:  73:  74:  75:  76:  77:  78:  79:  80:  81:  82:  83:  84:  85:  86:  87:  88:  89:  90:  91:  92:  93:  94:  95:  96:  97:  98:  99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 
<?php
/**
 * This class manage radio input fields.
 *
 * @package     Builder
 * @subpackage  Form\field
 * @copyright   &copy; 2005-2019 PHPBoost
 * @license     https://www.gnu.org/licenses/gpl-3.0.html GNU/GPL-3.0
 * @author      Regis VIARRE <crowkait@phpboost.com>
 * @version     PHPBoost 5.2 - last update: 2016 10 24
 * @since       PHPBoost 2.0 - 2009 04 28
 * @contributor Arnaud GENET <elenwii@phpboost.com>
*/

interface FormField extends FormElement
{
    /**
     * Returns the id.
     * @return string
     */
    function get_id();

    /**
     * Returns the label
     * @return string
     */
    function get_label();

    /**
     * Sets the id
     * @param string $id The id.
     */
    function set_id($id);

    /**
     * Sets the id prefix
     * @param string $prefix The new id prefix.
     */
    function set_form_id($prefix);

    /**
     * Sets the if of the fieldset which contains the field
     * @param $fieldset_id id of the fieldset
     */
    function set_fieldset_id($fieldset_id);

    /**
     * @return mixed
     */
    function get_value();

    /**
     * Sets the value
     * @param string $value The value
     */
    function set_value($value);

    /**
     * Tries to retrieve the value in the HTTP request's parameters.
     */
    function retrieve_value();

    /**
     * Returns the effective HTML id.
     * @return string
     */
    function get_html_id();

    /**
     * Tells whether the field is disabled
     * @return bool
     */
    function is_disabled();

    /**
     * Disabled the field
     */
    function disable();

    /**
     * Enables the field
     */
    function enable();

    /**
     * Validates the field by cheching if all the constraints are satisfied.
     * @return bool true if the form is valid
     */
    function validate();

    /**
     * Returns validation error message.
     */
    function get_validation_error_message();

    /**
     * Set the validation error message.
     * @param string $error_message The message to set
     */
    function set_validation_error_message($error_message);

    /**
     * Adds a constraint to the field constraints.
     * @param FormFieldConstraint $constraint The constraint to add
     */
    function add_constraint(FormFieldConstraint $constraint);

    /**
     * Add javascript code on the onblur field parameter that makes validation
     */
    function add_form_constraint(FormConstraint $constraint);

    /**
     * Return true if the field has one or more constraints, false otherwise.
     * @return boolean
     */
    function has_constraints();

    /**
     * Returns the javascript onsubmit code.
     * @return string The javascript code that makes the validation when the form is submitted
     */
    function get_js_validations();
}
?>