Hi list,
i just got some questions about radio and checkbox input types:
1. i wrote a small sample function to create a checkbox
input_check(char *label, char *name, int enabled) {
if(enabled > 0) {
cout << td(input().set("type","checkbox")
...
.set("checked","checked")
} else {
cout << td(input().set("type","checkbox")
...
}
is it possible doing this w.o. writing down the "whole input.sets twice" ?
(i just want to optimize the code , any suggestions welcome)
like
cout << td(input().set("type","checkbox")
...
if(enabled).set("checked","checked")
< sniiiip >
2. i wrote a small sample function to create a radio (-group)
input_radio(char *label, char *name, char *opt1, char *opt2, char *opt3, int
on) {
if(on==0) {
cout << td() << input().set("type","radio)
.set("value",opt1)
.set...
.set("selected","selected")
cout << opt1 << td();
cout << td() << input().set("type","radio)
.set("value",opt2)
.set...
cout << opt2 << td();
...
} else if (on==1) {
cout << td() << input().set("type","radio)
.set("value",opt1)
.set...
cout << opt1 << td();
cout << td() << input().set("type","radio)
.set("value",opt2)
.set...
.set("selected","selected")
cout << opt2 << td();
...
} else if (on==3) {
...
}
so i think - the problem is clear - like my above statement a kind of
cout << td() << input().set("type","radio)
.set("value",opt1)
.set...
if(on==0).set("checked","checked")
...
cout << td() << input().set("type","radio)
.set("value",opt2)
.set...
if(on==1).set("checked","checked")
< schnippppp >
any suggestions or ideas welcome... as you can guess, i am trying to write
small functions to (simple)create parts of my html form.]
greets jan
--
_______________________________________________
Get your free email from http://mymail.bsdmail.com
_______________________________________________
help-cgicc mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-cgicc