| Index
» Projekty
» phpMyEdit
» Fórum
» Quickly Flip a True/False value in List mode |
 |
Commsman
Založený: 29.05.2004
Príspevky: 7
Zaslal: 2004-06-07 15:14
Návrat hore
Odpovedať s citátom
|
Hi
I have a list of data, one column being a true/false -1/0 value. This is displayed as a tick or cross image using the values2 option in list mode only, and as True/False drop down in Add and Change mode.
I would like to add a little php code to the page in such a way as to toggle (flip) the value just by clicking on the tick or cross. I can easily write the sql to achieve this, but to get this to work I assume I will have to pass the record $key in the $HTTP_POST variables. Unfortunately, the $key keyword in the values2 aray does not work - it is passed on literally.
There must be a way to achieve this, but I cannot think how to do it.
Hope somebody has an idea. Thanks and regards
Julian
|
Commsman
Založený: 29.05.2004
Príspevky: 7
Zaslal: 2004-06-07 17:31
Návrat hore
Odpovedať s citátom
|
I can get this to work if I am prepared to forget about the image display, but if I use the URL setting, the <> are converted into string literals so the image does not display. I have tried turning escape off but this does not work.
Here is my URL line:
'URL'=>'$page?$url&id=$key&toggle=$name&value=$value',
Here is my values2 line:
'values2|LFCPDV'=>array( '-1'=>'<img src="tick.gif">', '0' => '<img src="cross.gif">'),
How can I escape the angle brackets <> ??
|
hbernard
Založený: 23.03.2003
Príspevky: 159
Bydlisko: FRANCE
Zaslal: 2004-06-11 09:27
Návrat hore
Odpovedať s citátom
|
| Commsman Napísal: |
I can get this to work if I am prepared to forget about the image display, but if I use the URL setting, the <> are converted into string literals so the image does not display. I have tried turning escape off but this does not work.
Here is my URL line:
'URL'=>'$page?$url&id=$key&toggle=$name&value=$value',
Here is my values2 line:
'values2|LFCPDV'=>array( '-1'=>'<img src="tick.gif">', '0' => '<img src="cross.gif">'),
How can I escape the angle brackets <> ?? |
Do you know the 'escape' field option ?
If it doesn't work the way you want, you'll have to use 'sql' options to make custom url build.
_________________ hbernard - phpMyEdit updater.
|
Commsman
Založený: 29.05.2004
Príspevky: 7
Zaslal: 2004-06-11 09:37
Návrat hore
Odpovedať s citátom
|
| hbernard Napísal: |
| Commsman Napísal: |
I have tried turning escape off but this does not work.
|
Do you know the 'escape' field option ?
If it doesn't work the way you want, you'll have to use 'sql' options to make custom url build. |
As I said - using the escape function does not work (or at least I cannot get it to work).
Not sure how to use the custom sql options to produce the code for a graphic image depending on the sql result - any ideas would be gratefully received.
Thanks for a great bit of software anyway!
Julian
|
hbernard
Založený: 23.03.2003
Príspevky: 159
Bydlisko: FRANCE
Zaslal: 2004-06-11 09:52
Návrat hore
Odpovedať s citátom
|
| Kód: |
'URL'=>'$page?$url&id=$key&toggle=$name&value=$value',
'sql' => 'concat(\'<img src=\"\',if(NAME_OF_THE_FIELD < 0,\'tick.gif\',\'cross.gif\'),\'\">\')',
'escape' => 'false', |
or something like that (not sure of my escaping).
I can't test for now, but tell me if this works.
_________________ hbernard - phpMyEdit updater.
|
Commsman
Založený: 29.05.2004
Príspevky: 7
Zaslal: 2004-06-11 11:16
Návrat hore
Odpovedať s citátom
|
Thanks - I am away now until next week sailing in Wales (just thought I'd drop that in to make everyone jealous ;-))
I will try out the idea and let you know if it works.
Cheers for now
Julian
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|