28 if(isset($validation)){
29 $validation->setIdentifier($field->
getDataField()->getIdentifier());
40 $params=$form->getValidationParams();
41 if(isset($params[
"_ajaxSubmit"])){
44 $form->removeValidationParam(
"_ajaxSubmit");
46 $compo->
addParams($form->getValidationParams());
47 $form->setBsComponent($compo);
48 $form->addEventsOnRun($js);
53 if(\is_array($ajaxSubmit)){
54 foreach ($ajaxSubmit as $ajaxSubmitItem){
55 $compilation.=$ajaxSubmitItem->compile($js);
57 }elseif($ajaxSubmit instanceof
AjaxCall){
58 $compilation=$ajaxSubmit->compile($js);
60 $compilation=str_ireplace(
"\"",
"%quote%", $compilation);
65 return $this->
getForm()->addToProperty(
"class",
"loading");
69 $this->
getForm()->addToProperty(
"class", $state);
76 $form->addToPropertyCtrl(
"class",
"attached", array (
"attached" ));
85 return $this->
getForm()->jsDoJquery(
"addClass", $state);
96 public function submitOn($event,$identifierOrElement,$url,$responseElement,$parameters=NULL){
98 if($identifierOrElement instanceof
BaseHtml)
99 $elem=$identifierOrElement;
101 $elem=$form->getElementById($identifierOrElement, $form->getContent());
103 $this->
_buttonAsSubmit($elem, $event,$url,$responseElement,$parameters);
108 public function submitOnClick($identifier,$url,$responseElement,$parameters=NULL){
109 return $this->
submitOn(
"click", $identifier, $url, $responseElement,$parameters);
112 public function addSubmit($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){
113 $bt=$this->
getForm()->addButton($identifier, $value,$cssStyle);
114 return $this->
_buttonAsSubmit($bt,
"click",$url,$responseElement,$parameters);
119 if(isset($url) && isset($responseElement)){
120 $button->
addEvent($event,
"$('#".$form->getIdentifier().
"').form('validate form');",
true,
true);
128 $params=[
"form"=>$form->getIdentifier(),
"responseElement"=>$responseElement,
"url"=>$url,
"stopPropagation"=>
true];
129 if(\is_array($parameters)){
130 $params=\array_merge($params,$parameters);
132 $form->addValidationParam(
"_ajaxSubmit",
new AjaxCall(
"postForm", $params));
136 public function addReset($identifier,$value,$cssStyle=NULL){
137 $bt=$this->
getForm()->addButton($identifier, $value,$cssStyle);
138 $bt->setProperty(
"type",
"reset");
149 $form->addValidationParam(
"onValid",
"%function(){".$jsCode.
"}%");
160 $form->addValidationParam(
"onSuccess", $jsCode,
"%function(event,fields){",
"}%");
166 $fv=$form->getExtraFieldValidation($fieldname);
167 foreach ($rules as $rule){
174 $fv=$form->getExtraFieldValidation($fieldname);
175 $fv->addRule($type,$prompt,$value);
180 $fv=$form->getExtraFieldValidation($fieldname);
181 $fv->setOptional($optional);
186 $form->setProperty(
'data-target',$target);
187 $form->setProperty(
'action',$action);
BaseHtml for HTML components.
addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false)
Semantic Message component.