Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: CGI form on click new window display

by edoc (Chaplain)
on Jan 31, 2005 at 12:12 UTC ( [id://426562]=note: print w/replies, xml ) Need Help??


in reply to CGI form on click new window display

Maybe I'm just confused, but I think you're basically there. Just move your form to another display function..

#!/usr/bin/perl use CGI; print $q->header(); %formvals = $q->Vars(); my $repaccess = $formvals{cvsrep}; my $repfunction = $formvals{function}; if($repfunction =~ /Register_User/) {<br> print $logo; &displayreg($repaccess); } elsif ($repfunction =~ /Delete_User/) { print $logo; &displaydel($repaccess); } elsif ($repfunction =~ /Show_All_Users/) { printf $logo; &showallusers($repaccess); } elsif ($repfunction =~ /Reset_Password/) { printf $logo; &displayreset($repaccess); } else { displayform(); } sub displayform{ printf "<h1>CVS User Management</h1><br>"; printf "<P>"; printf "<b>Please select which cvs repository your would like to adm +inister.</b><br><br>"; foreach my $rep (<@reps>) { printf $q->radio_group (-name => 'cvsrep',<nt> -values => [$rep], -linebreak => 'true'); } printf "<br>"; printf "<b>Please select the function to use. <br></b><br>"; my @functions = ('Register_User','Delete_User','Show_All_Users','Res +et_Password'); foreach my $func (<@functions>) { printf $q->checkbox_group (-name => 'function',<br> -values => [$func], -linebreak <br>=> 'true', -defaults => 'other'); } print "<br>"; print $q->reset; print $q->submit ('Submit', 'Submit'); print $q->endform; } sub displayreg { ... }

cheers,

J

Replies are listed 'Best First'.
Re^2: CGI form on click new window display
by minixman (Beadle) on Jan 31, 2005 at 14:31 UTC
    J

    THanks for the update, i tried your method and the first
    part of the code works, and i get the first form asking for
    information. When i try and submit the data to bring up the
    displayreg() code, i get an error
    , it is almost like the server does not know what i am talking about.
    The debug just says error 500.... i am not sure about this method.
      minixman, The "method" displayreg() is responsible to display in the browser ... Try to write this method ; Regards, Toxa.
        I have written this method
        But which is another form
        la
        sub displayreg() { printf $q->h1("CVS New User registation for $_[0]"); +# Print Header printf $q->start_form; printf "<br>"; printf "<b>Please enter the details below to register +a new user </b>";print"<br><br>"; printf "<EM>Users Username from GD </EM>"; print $q-> +textfield(-name=>'username',-size=>'20');print"<br><br>"; printf "<EM>Users Email Address </EM>"; print $q->tex +tfield(-name=>'emailaddr',-size=>'30');print"<br><br>"; printf $q->hidden(-name =>'mode',-value=>'regthisuser' +); printf $q->hidden(-name =>'repaccess',-value=>$_[0]); printf $q->submit(-value=>'Submit'); printf " "; printf $q->reset; printf $q->endform; printf "<BR>"; }

        So you see, first the user uses one form to select what they would like to do.
        then With that selection another form will be generated to handle their tasks
        . It is the second form generation that i have problems with

      That's a server error which means your script is failing. Make sure you have the following at the top of your code:

      #!/usr/bin/perl use strict; use warnings;

      then run your script and check your error logs. The logs should tell you what the problem is.

      cheers,

      J

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2024-03-28 12:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found