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: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293:
<?php
/**
* MvcCore
*
* This source file is subject to the BSD 3 License
* For the full copyright and license information, please view
* the LICENSE.md file that are distributed with this source code.
*
* @copyright Copyright (c) 2016 Tom Flidr (https://github.com/mvccore)
* @license https://mvccore.github.io/docs/mvccore/5.0.0/LICENCE.md
*/
namespace MvcCore\Ext\Forms\Field\Props;
/**
* Trait for classes:
* - `\MvcCore\Ext\Forms\Fields\Image`
* - `\MvcCore\Ext\Forms\Fields\SubmitButton`
* - `\MvcCore\Ext\Forms\Fields\SubmitInput`
*/
trait FormAttrs {
/**
* The URL that processes the data submitted by the input element,
* if it is a submit button or image. This attribute overrides the
* `action` attribute of the element's form owner.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-formaction
* @var string|NULL
*/
protected $formAction = NULL;
/**
* If the input element is a submit button or image, this attribute
* specifies how the form values will be encoded
* to send them to the server. Possible values are:
* - `application/x-www-form-urlencoded`
* By default, it means all form values will be encoded to
* `key1=value1&key2=value2...` string.
* Constant: `\MvcCore\Ext\IForm::ENCTYPE_URLENCODED`.
* - `multipart/form-data`
* Data will not be encoded to URL string form, this value is required,
* when you are using forms that have a file upload control.
* Constant: `\MvcCore\Ext\IForm::ENCTYPE_MULTIPART`.
* - `text/plain`
* Spaces will be converted to `+` symbols, but no other special
* characters will be encoded.
* Constant: `\MvcCore\Ext\IForm::ENCTYPE_PLAINTEXT`.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-formenctype
* @var string|NULL
*/
protected $formEnctype = NULL;
/**
* If the input element is a submit button or image, this attribute
* specifies the HTTP method that the browser uses to submit the form.
* Use `GET` only if form data contains only ASCII characters.
* Possible values: `'POST' | 'GET'`
* You can use constants:
* - `\MvcCore\Ext\IForm::METHOD_POST`
* - `\MvcCore\Ext\IForm::METHOD_GET`
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-formmethod
* @var string|NULL
*/
protected $formMethod = NULL;
/**
* If the input element is a submit button or image, this Boolean attribute
* specifies that the form shouldn't be validated before submission. This
* attribute overrides the `novalidate` attribute of the element's form owner.
* It means there will be no validation on client side, but there is always
* validation on server side.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-formnovalidate
* @var string|NULL
*/
protected $formNoValidate = NULL;
/**
* If the input element is a submit button or image, this attribute is
* a name or keyword indicating where to display the response that is
* received by submitting the form. This is a name of, or keyword for,
* a browsing context (e.g. tab, window, or inline frame). This attribute
* overrides the target attribute of the elements's form owner.
* The following keywords have special meanings:
* - `_self`: Load the response into the same browsing context as the
* current one. This value is the default if the attribute
* is not specified.
* - `_blank`: Load the response into a new unnamed browsing context.
* - `_parent`: Load the response into the parent browsing context of
* the current one. If there is no parent, this option
* behaves the same way as `_self`.
* - `_top`: Load the response into the top-level browsing context
* (i.e. the browsing context that is an ancestor of the
* current one, and has no parent). If there is no parent,
* this option behaves the same way as `_self`.
* - `iframename`: The response is displayed in a named `<iframe>`.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-formtarget
* @var string|NULL
*/
protected $formTarget = NULL;
/**
* Get the URL that processes the data submitted by the input element,
* if it is a submit button or image. This attribute overrides the
* `action` attribute of the element's form owner.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-formaction
* @return string|NULL
*/
public function GetFormAction () {
return $this->formAction;
}
/**
* Set the URL that processes the data submitted by the input element,
* if it is a submit button or image. This attribute overrides the
* `action` attribute of the element's form owner.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-formaction
* @param string $formAction
* @return \MvcCore\Ext\Forms\Field
*/
public function SetFormAction ($formAction) {
/** @var $this \MvcCore\Ext\Forms\Field */
$this->formAction = $formAction;
return $this;
}
/**
* If the input element is a submit button or image, this attribute
* specifies how the form values will be encoded
* to send them to the server. Possible values are:
* - `application/x-www-form-urlencoded`
* By default, it means all form values will be encoded to
* `key1=value1&key2=value2...` string.
* Constant: `\MvcCore\Ext\IForm::ENCTYPE_URLENCODED`.
* - `multipart/form-data`
* Data will not be encoded to URL string form, this value is required,
* when you are using forms that have a file upload control.
* Constant: `\MvcCore\Ext\IForm::ENCTYPE_MULTIPART`.
* - `text/plain`
* Spaces will be converted to `+` symbols, but no other special
* characters will be encoded.
* Constant: `\MvcCore\Ext\IForm::ENCTYPE_PLAINTEXT`.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-formenctype
* @return string|NULL
*/
public function GetFormEnctype () {
return $this->formEnctype;
}
/**
* If the input element is a submit button or image, this attribute
* specifies how the form values will be encoded
* to send them to the server. Possible values are:
* - `application/x-www-form-urlencoded`
* By default, it means all form values will be encoded to
* `key1=value1&key2=value2...` string.
* Constant: `\MvcCore\Ext\IForm::ENCTYPE_URLENCODED`.
* - `multipart/form-data`
* Data will not be encoded to URL string form, this value is required,
* when you are using forms that have a file upload control.
* Constant: `\MvcCore\Ext\IForm::ENCTYPE_MULTIPART`.
* - `text/plain`
* Spaces will be converted to `+` symbols, but no other special
* characters will be encoded.
* Constant: `\MvcCore\Ext\IForm::ENCTYPE_PLAINTEXT`.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-formenctype
* @param string $formEnctype
* @return \MvcCore\Ext\Forms\Field
*/
public function SetFormEnctype ($formEnctype) {
/** @var $this \MvcCore\Ext\Forms\Field */
$this->formEnctype = $formEnctype;
return $this;
}
/**
* If the input element is a submit button or image, this attribute
* specifies the HTTP method that the browser uses to submit the form.
* Use `GET` only if form data contains only ASCII characters.
* Possible values: `'POST' | 'GET'`
* You can use constants:
* - `\MvcCore\Ext\IForm::METHOD_POST`
* - `\MvcCore\Ext\IForm::METHOD_GET`
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-formmethod
* @return string|NULL
*/
public function GetFormMethod () {
return $this->formMethod;
}
/**
* If the input element is a submit button or image, this attribute
* specifies the HTTP method that the browser uses to submit the form.
* Use `GET` only if form data contains only ASCII characters.
* Possible values for `$formMethod` param: `'POST' | 'GET'`
* You can use constants:
* - `\MvcCore\Ext\IForm::METHOD_POST`
* - `\MvcCore\Ext\IForm::METHOD_GET`
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-formmethod
* @param string $formMethod
* @return \MvcCore\Ext\Forms\Field
*/
public function SetFormMethod ($formMethod) {
/** @var $this \MvcCore\Ext\Forms\Field */
$this->formMethod = $formMethod;
return $this;
}
/**
* If the input element is a submit button or image, this Boolean attribute
* specifies that the form shouldn't be validated before submission. This
* attribute overrides the `novalidate` attribute of the element's form owner.
* It means there will be no validation on client side, but there is always
* validation on server side. Only `TRUE` renders the form attribute.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-formnovalidate
* @return string|NULL
*/
public function GetFormNoValidate () {
return $this->formNoValidate;
}
/**
* If the input element is a submit button or image, this Boolean attribute
* specifies that the form shouldn't be validated before submission. This
* attribute overrides the `novalidate` attribute of the element's form owner.
* It means there will be no validation on client side, but there is always
* validation on server side. Only `TRUE` renders the form attribute.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-formnovalidate
* @param bool|NULL $formNoValidate Only `TRUE` renders the form attribute.
* @return \MvcCore\Ext\Forms\Field
*/
public function SetFormNoValidate ($formNoValidate = TRUE) {
/** @var $this \MvcCore\Ext\Forms\Field */
$this->formNoValidate = $formNoValidate;
return $this;
}
/**
* If the input element is a submit button or image, this attribute is
* a name or keyword indicating where to display the response that is
* received by submitting the form. This is a name of, or keyword for,
* a browsing context (e.g. tab, window, or inline frame). This attribute
* overrides the target attribute of the elements's form owner.
* The following keywords have special meanings:
* - `_self`: Load the response into the same browsing context as the
* current one. This value is the default if the attribute
* is not specified.
* - `_blank`: Load the response into a new unnamed browsing context.
* - `_parent`: Load the response into the parent browsing context of
* the current one. If there is no parent, this option
* behaves the same way as `_self`.
* - `_top`: Load the response into the top-level browsing context
* (i.e. the browsing context that is an ancestor of the
* current one, and has no parent). If there is no parent,
* this option behaves the same way as `_self`.
* - `iframename`: The response is displayed in a named `<iframe>`.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-formtarget
* @return string|NULL
*/
public function GetFormTarget () {
return $this->formTarget;
}
/**
* If the input element is a submit button or image, this attribute is
* a name or keyword indicating where to display the response that is
* received by submitting the form. This is a name of, or keyword for,
* a browsing context (e.g. tab, window, or inline frame). This attribute
* overrides the target attribute of the elements's form owner.
* The following keywords have special meanings:
* - `_self`: Load the response into the same browsing context as the
* current one. This value is the default if the attribute
* is not specified.
* - `_blank`: Load the response into a new unnamed browsing context.
* - `_parent`: Load the response into the parent browsing context of
* the current one. If there is no parent, this option
* behaves the same way as `_self`.
* - `_top`: Load the response into the top-level browsing context
* (i.e. the browsing context that is an ancestor of the
* current one, and has no parent). If there is no parent,
* this option behaves the same way as `_self`.
* - `iframename`: The response is displayed in a named `<iframe>`.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-formtarget
* @param string $formTarget
* @return \MvcCore\Ext\Forms\Field
*/
public function SetFormTarget ($formTarget) {
/** @var $this \MvcCore\Ext\Forms\Field */
$this->formTarget = $formTarget;
return $this;
}
}