in reply to CGI delete attributes set in textfield()
You've got a static argument list, so there's no way to "delete" them short of editing the code. So instead of hard-coding it what you need to do: build up the argument list in a variable, adding in the onfoo attributes if needed, then pass that dynamic list to the textfield method.
my @textfield_args = ( -name => 'name', ..., -maxlength => 120, ); if( $was_no_change ) { push @textfield_args, -onfocus => 'this.value = ''"; push @textfield_args, -onblur => 'this.value = 'def'"; push @textfield_args, -onchange => 'delete onfocus, delete onblur"; } $string .= $cgi->textfield( @textfield_args );
The cake is a lie.
The cake is a lie.
The cake is a lie.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: CGI delete attributes set in textfield()
by KaiAllard_ (Initiate) on Feb 21, 2008 at 15:21 UTC | |
by Fletch (Bishop) on Feb 21, 2008 at 15:37 UTC |