1 | <?php |
||
8 | trait FormTrait{ |
||
9 | /** |
||
10 | * @return HtmlForm |
||
11 | */ |
||
12 | abstract protected function getForm(); |
||
13 | |||
14 | public function setLoading() { |
||
17 | |||
18 | public function addErrorMessage(){ |
||
21 | |||
22 | public function jsState($state) { |
||
25 | |||
26 | /** |
||
27 | * @param string $event |
||
28 | * @param string $identifier |
||
29 | * @param string $url |
||
30 | * @param string $responseElement |
||
31 | * @return \Ajax\semantic\html\collections\form\HtmlForm |
||
32 | */ |
||
33 | public function submitOn($event,$identifier,$url,$responseElement){ |
||
41 | |||
42 | public function submitOnClick($identifier,$url,$responseElement){ |
||
45 | |||
46 | public function addSubmit($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL){ |
||
50 | |||
51 | protected function _buttonAsSubmit($button,$event,$url,$responseElement=NULL){ |
||
59 | |||
60 | public function addReset($identifier,$value,$cssStyle=NULL){ |
||
65 | |||
66 | /** |
||
67 | * Callback on each valid field |
||
68 | * @param string $jsCode |
||
69 | * @return \Ajax\semantic\html\collections\form\HtmlForm |
||
70 | */ |
||
71 | public function onValid($jsCode){ |
||
76 | |||
77 | /** |
||
78 | * Callback if a form is all valid |
||
79 | * @param string $jsCode can use event and fields parameters |
||
80 | * @return HtmlForm |
||
81 | */ |
||
82 | public function onSuccess($jsCode){ |
||
87 | } |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: