Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: perl + cgi - onclick generation problem

by matrixmadhan (Beadle)
on Dec 11, 2008 at 07:09 UTC ( [id://729621]=note: print w/replies, xml ) Need Help??


in reply to Re: perl + cgi - onclick generation problem
in thread perl + cgi - onclick generation problem

Thanks for the reply

Sorry, am not clear with how to do that.
I can retrieve the value in the hidden field using
$cgi->param('hidden_field');
But how to set the incremented value in the same hidden field ( this value indicates the number of set of textarea fields displayed )
The only way I know to set a value for hidden_field is while creating, am not sure how to do the same without creating a new hidden_field for each time

Any pointers?

Replies are listed 'Best First'.
Re^3: perl + cgi - onclick generation problem
by almut (Canon) on Dec 11, 2008 at 07:28 UTC
    But how to set the incremented value in the same hidden field (...) The only way I know to set a value for hidden_field is while creating

    Well, you are creating the field anew for every page view, anyway (if we're talking about the non-javascript variant, that is), so just set the value as you did the first time...

    Or, in case you're using CGI for HTML generation, too (not just for parameter parsing), you can modify the (otherwise sticky) value with:

    $cgi->param('hidden_field', 'new value');
      I simply ran out of idea and cannot proceed further
      This is the code snippet what I had tried and it never works the way as expected
      sub hidden_field { my $counter = $cgi->param('field_1'); if ( not defined $counter ) { $counter = 1; } else { $counter++; } print $cgi->hidden('field_1', $counter); return $counter; } my $count = hidden_field; foreach ( 1 .. $count ) { #here is a seperate function that generates set of 3 text_area }
      Any pointers please?
        I got it :)
        print $cgi->hidden( -name => $field_name, -default => $field_data, -override => 1 );
        This is what I want and its working now as expected.
        Thanks for all the help offered :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://729621]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-18 02:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found