Categories > TinyButStrong general >

List Box again again ...

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: boubou
Date: 2003-04-28
Time: 21:57

List Box again again ...

i found your generation template very interresting but i've got a problem.

here my code that 's working fine
                  <select name="SecGeo1" id="SecGeo1">
                  <option>[blk2.GEOCODE;block=opt;if [val]=France;then "ok";else "no ok"]</option>
                  </select>

here my code that's not working fine
                  <select name="SecGeo1" id="SecGeo1">
                  <option>[blk2.GEOCODE;block=opt;if [val]=[blk1.GEOCODE];then "ok";else "no ok"]</option>
                  </select>

... php code...
$ObjTBS->MergeBlock("blk1",$cnx,"select * TABLE where toto=idx");
$ObjTBS->MergeBlock("blk2",$cnx,"select * from SECT_GEO_1 order by SG1_CODE");


i' found in faq a piece of reponse but that not usefull

please help...


By: boubou
Date: 2003-04-28
Time: 22:43

Re: List Box again again ...

i'd find it: htmlconv=no

but how the selected TAG works ?!!! i'd dont success
By: Skrol29
Date: 2003-04-29
Time: 00:21

Re: List Box again again ...

Hello Boubou,

First I've noticed that the block blk1 is not defined (with block=...) but you probably have definied it somewhere else in the template.

Its seems that blk2 is embeded within blk1. If it's so, after the blk1 merge, you will have several blk2 definitions. And after, when you will merge blk2, the several definitions make a display alternance. Just like an altlernance of color for the rows of a table. Ther don't make a sub-block merge.

By: Skrol29
Date: 2003-04-29
Time: 00:29

Re: List Box again again ...

You mean the selected tag or the 'selected' parameter ?

The 'selected' parameter acts just after its field is merged.
All <option> of the <select> definition are scanned, and if one has a value equal to the field's value, then this option is set to selected. Otherwise, the field's value i added as a new <option> item.
By: boubou
Date: 2003-04-29
Time: 16:54

Re: List Box again again ... (fr)

in french je va gagner du temps ^^
salut skrol29
d'abord bravo pour ton générateur de modéles,il est vraiment génial...
je débute en php (mais  j'ai fait bq d'autres langages avant assembleur au l4g lol )

effectivement j'ai po compris comment on faisait fonctionner le selected dans un bloc simple... je me suis donc arrangé pour faire un if  then <option> else <option selected> a la main dans un <block=begin> etc

donc la cela fonctionne par contre j'ai d'énormes problémes d'accents (HTML ) car ma base vient d'un access97, ton param frm ne permet po convertions ?

sinon franchement je pensais faire un tbs a moi avant de trouver le tien merci pour tous...
a+
By: Skrol29
Date: 2003-04-29
Time: 20:26

Re: List Box again again ...

Salut Boubou,

pour les accents, il sont convetis automatiquements sauf si tu as mis htmlconv=no ou htmlconv=look.

à priori, si tu as utilisé un format avec frm, alors la chaîne formatée ne doit pas contenir d'accent puisque c'est un nombre ou une date.

pour ton selected, le plus simple (à part le paramètre selected) c'est de placer un champ comme ça :
<option [blk.numero;if [val]=123;then 'selected';else '']>[blk.numero]</option>

Voilà, si ça ne t'aides pas beaucoup, donne moi plus de détail sur le code et je tâcherais de t'aider.
By: boubou
Date: 2003-04-29
Time: 22:33

Re: List Box again again ...

merci de tes aides j'avance p'tit a petit j'ai des problémes de compréhension du php et du html donc chaque pas est une découverte  donc voila un exemple
                  <select name="SecGeo2">
                  <option>-----------------------------------------------------------------------</option>
                  <option [blk3.SG2_CODE;block=opt;if [val]=[blk1.SG2_CODE];then 'selected';else '']>[blk3.SG2_CODE]</option>
                  </select>                    

$ObjTBS->MergeBlock("blk1",$cnx,"select s.*,a.SG1_LIB,b.SG2_LIB,c.SG3_LIB,d.SG4_LIB from SITE s, SECT_GEO_1 a,SECT_GEO_2 b,SECT_GEO_3 c,SECT_GEO_4 d  where (SIT_NUM=".$id." and a.SG1_CODE = s.SG1_CODE and b.SG2_CODE = s.SG2_CODE and c.SG3_CODE = s.SG3_CODE and d.SG4_CODE = s.SG4_CODE)");

$ObjTBS->MergeBlock("blk2",$cnx,"select * from SECT_GEO_1 order by SG1_CODE");
$ObjTBS->MergeBlock("blk3",$cnx,"select a.SG2_CODE from SECT_GEO_2 a,SITE b where (b.SIT_NUM=".$id." and a.SG1_CODE = b.SG1_CODE)" );

le probléme c'est que j'ai dans SG_CODExx des valeurs telles que:
Rhô-Al pour Rhône-Alpes mais des qu'il y a un champs accentué big ça passe po

pourtant:
A- Quand il n'y a pas d'accents ds le CODE c'est nickel chrome in the night to night
B- Le select est bien remplit par la liste c'est vraiment le test Rhone Alpes qui n'est po selectionné

Merci du temps que tu passe a débugé car je sais que c'est plus des problémes PHP/HTM que TBS

A+
By: Skrol29
Date: 2003-04-30
Time: 09:59

Re: List Box again again ...

Es-tu sûr que dans tes tables les valeurs de champs ont bien la même valeur avec les accents ?

Si oui, essai ça :

<option [blk3.SG2_CODE;block=opt;htmlconv=no;if [val]=[blk1.SG2_CODE;htmlconv=no];then 'selected';else '']>[blk3.SG2_CODE]</option>
By: boubou
Date: 2003-04-30
Time: 22:02

Re: List Box again again ...

it's ok >Post Reply

z'avais oublié un ;htmlconv=no effectivement ds le [] du if

merci m'sieur

et comme je suis DEBILE -si tu peux enleve le message dans la racine du forum- désolé chef ;)