My advice: throw CGI.pm's stupid HTML wrappers away and write HTML directly. They are not worth it. There's no black box in front of you if you bother to write the forms directly. The only thing CGI.pm is useful for is accessing HTTP headers and query params. [1] Anyway, I'll let you on a secret. The #1 debugging tool in web programming. Ctrl-U (View Source).
Then I thought it might be a good point to use radio buttons instead. And when I add those lines of code, then I was able to click only one radio button per column and not per row as I expected (as all td's are mapped within Tr) ?!!? What am I missing here ?
Radio buttons are grouped based on their name attribute.
Another question is the behaviour of the checkbox group (named GRU in my case) where I would like "Ej" box to be unchecked if any(or more) of the previous boxes are checked - could I use onCheck here and how ? Or even better, is it possible to "make" checkboxes send a name even if they don't have a value (undef) ?
If you want only one of them to be checked, use radio buttons. oncheck is javascript and is dependent on the client browser to work. (Bad idea in my opinion, but seeing the current trends in web development, I'm in the minority.)
Checkboxes (or radio buttons) aren't submitted with the form if none are selected. You can default your params like this: $q->param(GRU => "Ej") unless $q->param('GRU');
I was trying to add a row to this table by clicking button "Addera rad". My idea was to add en empty row to a file I'm reading the table from and then call subroutine again. And it works so long that "empty" csv row is created in a file. But then, when I recall this subroutine, I get only one (first) row of a file. What am I missing here ?
Du måste addera din rad to the loop. Your loop is dependent on the file handle TEMP currently. It won't generate a single row after that. I'm afraid I'm not sure how to help there since the code looks pretty much a mess thanks to CGI.pm. (There's a map where usually a for loop would be.)
[1] Okay, I'll give it one more. It's okay for doing form prefills.
In reply to Re: Problems with CGI script behaviour
by Anonymous Monk
in thread Problems with CGI script behaviour
by SerZKO
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |