Login   Register  
PHP Classes
elePHPant
Icontem

ValidateAsDifferentFrom

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      Forms generation and validation  >  All threads  >  ValidateAsDifferentFrom  >  (Un) Subscribe thread alerts  
Subject:ValidateAsDifferentFrom
Summary:ValidateAsDifferentFrom with "form_linked_select_class"
Messages:4
Author:wilson costa
Date:2012-04-17 19:50:44
Update:2012-04-21 21:04:25
 

  1. ValidateAsDifferentFrom   Reply  
Picture of wilson costa
wilson costa
2012-04-17 19:50:45
Hi,

I found the follow problem: I'm trying to use the "ValidateAsDifferentFrom" in a field "CustomClass"=>"form_linked_select_class" : localizacaoB, the field to be compared is too a "CustomClass"=>"form_linked_select_class" : localizacaoA, and appear the follow error message:

[Tue Apr 17 15:31:51 2012] [error] [client 10.22.180.14] PHP Notice: localizacaoA: could not retrieve the Javascript input value in /var/www/gf/cofxi/formGeneration/forms.php on line 730

I'd appreciate if you could help me,
best regards.
Wilson

$form->AddInput(array(
"TYPE"=>"select",
"ID"=>"abrangencia",
"NAME"=>"abrangencia",
"LABEL"=>"Abrangencia",
"VALUE"=> "",
"OPTIONS"=>$abrangencia_bd,
"ValidateAsNotEmpty"=>1,
"ValidationErrorMessage"=>"Abrangência inválida"
));

$form->AddInput(array(
"TYPE"=>"custom",
"ID"=>"barramento",
"NAME"=>"barramento",
"LABEL"=>"Barramento Dwdm",
"CustomClass"=>"form_linked_select_class",
"VALUE"=> "",
"SIZE"=>1,
"Groups"=>$barrdwdm_bd,
"LinkedInput"=>"abrangencia",
"AutoWidthLimit"=>20,
"AutoHeightLimit"=>1,
"ValidateAsNotEmpty"=>1,
"ValidationErrorMessage"=>"Barramento Dwdm inválido"
));

$form->AddInput(array(
"TYPE"=>"custom",
"ID"=>"localizacaoA",
"NAME"=>"localizacaoA",
"LABEL"=>"Localização A",
"CustomClass"=>"form_linked_select_class",
"VALUE"=> "",
"SIZE"=>1,
"Groups"=>$local_bd,
"LinkedInput"=>"barramento",
"AutoWidthLimit"=>25,
"AutoHeightLimit"=>1,
"ValidateAsNotEmpty"=>1,
"ValidationErrorMessage"=>"Localização A inválida"
));

$form->AddInput(array(
"TYPE"=>"custom",
"ID"=>"localizacaoB",
"NAME"=>"localizacaoB",
"LABEL"=>"Localização B",
"SIZE"=>1,
"CustomClass"=>"form_linked_select_class",
"VALUE"=> "",
"Groups"=>$local_bd,
"LinkedInput"=>"barramento",
"AutoWidthLimit"=>25,
"AutoHeightLimit"=>1,
"ValidateAsNotEmpty"=>1,
"ValidationErrorMessage"=>"Localização B inválida"
"ValidateAsDifferentFrom"=>"localizacaoA",
"ValidateAsDifferentFromTextErrorMessage"=>"Localização B não pode ser igual a Localização A"
));


  2. Re: ValidateAsDifferentFrom   Reply  
Picture of Manuel Lemos
Manuel Lemos
2012-04-19 11:02:54 - In reply to message 1 from wilson costa
Try adding this function inside the class in form_linked_select.php plug-in class script and let me know if it works well for you.

Function GetJavascriptInputValue(&$form, $form_object)
{
return($form->GetJavascriptInputValue($form_object, $this->select));
}

  3. Re: ValidateAsDifferentFrom   Reply  
Picture of wilson costa
wilson costa
2012-04-20 14:15:50 - In reply to message 2 from Manuel Lemos
Hi, thank you for your help. I insert the new function as you said and it works, but the message error doesn't work well. When the field Location A = Location B, appear the message error "ValidationErrorMessage", I suppose that must appear the message error "ValidateAsDifferentFromTextErrorMessage".
I have two checks, one "ValidateAsNotEmpty" and another "ValidateAsDifferentFrom".

thanks again,

wilson






  4. Re: ValidateAsDifferentFrom   Reply  
Picture of Manuel Lemos
Manuel Lemos
2012-04-21 21:04:25 - In reply to message 3 from wilson costa
That is because you set the error message with ValidateAsDifferentFromTextErrorMessage, but it should be ValidateAsDifferentFromErrorMessage .