|
![Picture of Osvaldo Prado Picture of Osvaldo Prado](/graphics/unknown.gif) Osvaldo Prado - 2008-05-01 14:10:06
I have one problem in form_mysql_linked_select_class , its dont get results from Linked Input
It´s correct ?
$form_potencia_inc->AddInput(array(
"TYPE"=>"custom",
"ID"=>"estado_potencia",
"NAME"=>"estado_potencia",
"LABEL"=>"<u>E</u>stado",
"ACCESSKEY"=>"p",
"CustomClass"=>"form_mysql_linked_select_class",
"Connection"=>$connection,
"GroupsQuery"=>"SELECT ID_ESTADO FROM ESTADOS",
"OptionsQuery"=>"SELECT ID_ESTADO, DSC_ESTADO FROM ESTADOS",
"DefaultOption"=>"",
"DefaultOptionValue"=>"Selecione um Estado",
"Dynamic"=>1,
"VALUE"=>"",
"LinkedInput"=>"estado_potencia",
"SIZE"=>1,
"AutoWidthLimit"=>0,
"AutoHeightLimit"=>0,
"ValidateAsNotEmpty"=>1,
"ValidationErrorMessage"=>"Esta não é um Estado valido"
));
$form_potencia_inc->AddInput(array(
"TYPE"=>"custom",
"ID"=>"oriente_potencia",
"NAME"=>"oriente_potencia",
"LABEL"=>"<u>O</u>riente",
"ACCESSKEY"=>"p",
"CustomClass"=>"form_mysql_linked_select_class",
"Connection"=>$connection,
"GroupsQuery"=>"SELECT ID_CIDADE FROM CIDADES",
"OptionsQuery"=>"SELECT ID_CIDADE, DSC_CIDADE FROM CIDADES WHERE COD_ESTADO={GROUP}",
"DefaultOption"=>"",
"DefaultOptionValue"=>"Selecione uma Cidade",
"Dynamic"=>1,
"VALUE"=>"",
"LinkedInput"=>"estado_potencia",
"SIZE"=>1,
"AutoWidthLimit"=>0,
"AutoHeightLimit"=>0,
"ValidateAsNotEmpty"=>1,
"ValidationErrorMessage"=>"Esta não é um Estado valido"
));
![Picture of Manuel Lemos Picture of Manuel Lemos](/picture/user/1.jpg) Manuel Lemos - 2008-05-01 17:45:02 - In reply to message 1 from Osvaldo Prado
This does not make much sense. The estado_potencia input is linked to itself. It should be linked to another input, maybe a static select input with the groups of options that it will display. Take a look at the test_mysql_linked_select.php example script.
![Picture of Osvaldo Prado Picture of Osvaldo Prado](/graphics/unknown.gif) Osvaldo Prado - 2008-05-02 10:48:51 - In reply to message 2 from Manuel Lemos
But if he really has not a static entry, be only state and city, which I use for only read data from Mysql?
![Picture of Osvaldo Prado Picture of Osvaldo Prado](/graphics/unknown.gif) Osvaldo Prado - 2008-05-02 16:01:16 - In reply to message 3 from Osvaldo Prado
I am try it
$potencias=array(
""=>"Selecione uma Potência",
"1"=>"GLUP"
);
$form->AddInput(array(
"TYPE"=>"select",
"ID"=>"potencia",
"NAME"=>"potencia",
"LABEL"=>"<u>P</u>otencia",
"ACCESSKEY"=>"C",
"VALUE"=>"",
"OPTIONS"=>$potencias,
"ValidateAsNotEmpty"=>1,
"ValidationErrorMessage"=>"Esta não é uma potencia valida."
));
$form->AddInput(array(
"TYPE"=>"custom",
"ID"=>"loja",
"NAME"=>"loja",
"LABEL"=>"<u>L</u>oja",
"ACCESSKEY"=>"L",
"CustomClass"=>"form_mysql_linked_select_class",
"Connection"=>$connection,
"GroupsQuery"=>"SELECT ID_LOJA FROM LOJA",
"OptionsQuery"=>"SELECT ID_LOJA, NOME FROM LOJA WHERE POTENCIA_ID_POTENCIA={GROUP}",
"DefaultOption"=>"",
"DefaultOptionValue"=>"Selecione uma Loja",
"Dynamic"=>1,
"VALUE"=>"",
"LinkedInput"=>"potencia",
"SIZE"=>1,
"AutoWidthLimit"=>0,
"AutoHeightLimit"=>0,
"ValidateAsNotEmpty"=>1,
"ValidationErrorMessage"=>"Esta não é uma Loja Valida"
));
![Picture of Manuel Lemos Picture of Manuel Lemos](/picture/user/1.jpg) Manuel Lemos - 2008-05-02 18:13:51 - In reply to message 3 from Osvaldo Prado
If it is a select input with a fixed group of options, just retrieve those options from the database build the associative array and add a simple select input with the options set to the array values.
![Picture of Iaster C Aki Picture of Iaster C Aki](/graphics/unknown.gif) Iaster C Aki - 2009-06-25 13:33:19 - In reply to message 5 from Manuel Lemos
Please what I'm doing that it is not working?
$grupo = array( "C"=>"Clientes", "F"=>"Funcionários Inova" );
$form->AddInput(array(
"TYPE"=>"select",
"NAME"=>"grupo",
"ID"=>"grupo",
"VALUE"=>dbDoctos::getInstance()->getGrupo(),
"SIZE"=>1,
"OPTIONS"=>$grupo,
"ValidationErrorMessage"=>"Nenhum grupo de usuário foi informado.",
"LABEL"=>"<u>G</u>rupo",
"ACCESSKEY"=>"G"
));
$form->AddInput(array(
"TYPE"=>"custom",
"ID"=>"usuario",
"NAME"=>"usuario",
"LABEL"=>"<u>U</u>suário",
"ACCESSKEY"=>"U",
"CustomClass"=>"form_mysql_linked_select_class",
"Connection"=>$connection,
"GroupsQuery"=>"SELECT id FROM usuarios",
"OptionsQuery"=>"SELECT id, nome FROM usuarios WHERE tipo={GROUP}",
"DefaultOption"=>"",
"DefaultOptionValue"=>"Todos",
"Dynamic"=>1,
"VALUE"=>"",
"LinkedInput"=>"grupo",
"SIZE"=>1,
"AutoWidthLimit"=>0,
"AutoHeightLimit"=>0,
"ValidateAsNotEmpty"=>1,
"ValidationErrorMessage"=>"Nenhum usuário válido foi selecionado."
));
![Picture of Manuel Lemos Picture of Manuel Lemos](/picture/user/1.jpg) Manuel Lemos - 2009-06-25 22:13:50 - In reply to message 6 from Iaster C Aki
It depends on what happens.
First make sure that dbDoctos::getInstance()->getGrupo() always returns a value that is a key of $grupo array. In your case it should be either "C" or "F" .
![Picture of Iaster C Aki Picture of Iaster C Aki](/graphics/unknown.gif) Iaster C Aki - 2009-06-26 11:10:47 - In reply to message 7 from Manuel Lemos
Manuel, thanks for your reply.
The dbDoctos::getInstance()->getGrupo() is working. The real problem is that after I select the option "F" or "C" the information of the mysql is not refreshed. The mysql field is always the same, does not matter what I select in grupo field.
![Picture of Manuel Lemos Picture of Manuel Lemos](/picture/user/1.jpg) Manuel Lemos - 2009-06-26 17:51:41 - In reply to message 8 from Iaster C Aki
It is hard to tell without seeing the whole script.
Anyway, are you sure you care calling the HandleEvent function after AddInput, and you are not outputting nothing to the page before the HandleEvent call?
![Picture of Iaster C Aki Picture of Iaster C Aki](/graphics/unknown.gif) Iaster C Aki - 2009-06-27 13:20:04 - In reply to message 9 from Manuel Lemos
Manuel, you are the man! (we use to say that here in Brasil). That is great. The problem was the HandleEvent. After I include this everything is working pretty well.
Very tanks.
|