Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^16: Need to know the process to implement perl script into web application server.

by chandantul (Scribe)
on Jul 15, 2021 at 02:05 UTC ( [id://11135008]=note: print w/replies, xml ) Need Help??


in reply to Re^15: Need to know the process to implement perl script into web application server.
in thread Need to know the process to implement perl script into web application server.

Hi, I have made the modification in query.tt but i was unable to distinguish them in webapp.pm. Maybe i need correct syntax. Please check below my query.tt and webapp.pm . How can i retrieve submit button name and distinguish them in my webapp.pm?

<form id="f1" method="post" action="/"> <style> body { background-color: #ABBAEA; } div { height: 200px; background-color: #FBD603; } </style> <body> <div> <input type="radio" name="OKTAUsersList"> <label for="OKTAUsersList">OKTA-Users-List</label> <label for="Email">Recipient Email</label> <input id="email" name="Email"> <input type="submit" name="Users-list" value="Users-list" /> </div> <div> <input type="radio" name="OKTAAppsList"> <label for="OKTAAppsList">OKTA-Apps-List</label> <label for="Email">Recipient Email</label> <input id="email" name="Email"> <input type="submit" name="Apps-list" value="Apps" /> </div> </body> </form>

webapp.pm

post '/' => sub { my $_POST = "post"; if (body_parameters->get('name') eq 'Users-list' ) { $id = route_parameters->get('site_id'); my $site_id2 = params->{$id}; @access_token = client2($site_id2)->get_access_token($p); print Dumper \@access_token; } };

Replies are listed 'Best First'.
Re^17: Need to know the process to implement perl script into web application server.
by choroba (Cardinal) on Jul 15, 2021 at 07:28 UTC
    webapp.pm
    package webapp; use Dancer2; my %common = (title => 'webapp'); get '/' => sub { template index => { %common }; }; post '/' => sub { if (body_parameters->get('Users-list') eq 'Users-list' ) { template index => { %common, button => 'Users-list' } } elsif (body_parameters->get('Apps-list') eq 'Apps') { template index => { %common, button => 'Apps-list' } } }; true;
    index.tt
    [% IF button %] <p>You pressed [% button %].</p> [% ELSE %] <form id="f1" method="post" action="/"> <div> <input type="radio" name="OKTAUsersList"> <label for="OKTAUsersList">OKTA-Users-List</label> <label for="Email">Recipient Email</label> <input id="email" name="Email"> <input type="submit" name="Users-list" value="Users-list" /> </div> <div> <input type="radio" name="OKTAAppsList"> <label for="OKTAAppsList">OKTA-Apps-List</label> <label for="Email">Recipient Email</label> <input id="email" name="Email"> <input type="submit" name="Apps-list" value="Apps" /> </div> </form> [% END %]
    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2024-04-26 07:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found