Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by chandantul (Scribe)
on May 23, 2021 at 05:33 UTC ( [id://11132906]=note: print w/replies, xml ) Need Help??


in reply to Re^11: 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.

Hello Sir, How can i add multiple sub program under single query.tt in my Dancer2 app? Please check my current code but i would like add redio buttons for multiple app and its respective submit buttons , If i hit any of the redio buttons then its targetting to to main program only. but i will need its should target its respective sub program

My Current query.tt

<form id="f1" method="post" action="/"> <style> body { background-color: #ABBAEA; } div { height: 200px; background-color: #FBD603; } </style> <body> <div> <p>Synchrony OKTA MFA N +etwork Analysis Report Automated Application </p> <label for="APPID">Application ID</label> <input id="text" name="APPID"> <label for="date">Time in Hours</label> <input id="date" name="date"> <label for="Email">Recipient Email</label> <input id="email" name="Email"> <button>Submit</button> </div> <div> <input type="radio" name="Preview Users List"> <label for="Preview Users List">OKTA Preview Users List</label> <button>Submit</button> </div> </body> </form> <form id="f11" method="post" action="/"> <style> body { background-color: #ABBAEA; } div { height: 200px; background-color: #FBD603; } </style> <body> <div> <input type="radio" name="Preview Users List"> <label for="Preview Users List">OKTA Preview Users List</label> <button>Submit</button> </div> </body> </form>
  • Comment on Re^12: Need to know the process to implement perl script into web application server.
  • Download Code

Replies are listed 'Best First'.
Re^13: Need to know the process to implement perl script into web application server.
by choroba (Cardinal) on May 23, 2021 at 16:58 UTC
    This is not related to Dancer. You specified two forms (BTW, <body> can't be an ancestor of <form>), so use different actions for them. Or use a single form, but somehow differentiate the submit buttons.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

      Hello Sir, I have written separate function for the other lable but its still targeting to first function. is this possible for you let me know where i am wrong here?

      Please check below details for webapp.pm , query.tt .help me if possible.

      query.tt

      <form id="f1" method="post" action="/"> <style> body { background-color: #ABBAEA; } div { height: 200px; background-color: #FBD603; } </style> <body> <div> <p> Report Automated Ap +plication </p> <label for="APPID">Application ID</label> <input id="text" name="APPID"> <label for="date">Time in Hours</label> <input id="date" name="date"> <label for="Email">Recipient Email</label> <input id="email" name="Email"> <button>Submit</button> </div> <div> <input type="radio" name="UsersList"> <label for="UsersList">Users-List</label> <label for="Email">Recipient Email</label> <input id="email" name="Email"> <button>Submit</button> </div> </body> </form>

      webapp.pm

      package webapp; use Dancer2; #use Dancer::Plugin::RequireSSL; use Op; use Op1; our $VERSION = '0.1'; #require_ssl(); get '/' => sub { template 'query' => { 'title' => 'webapp' }; }; post '/' => sub { my $r = Op::result({APPID => param('APPID'), date => param('date'), Email => param('Email')}); template result => { title => 'webapp', result => $r } }; post '/' => sub { my $r2 = Op1::result2({UsersList => param('Users-List'), Email => param('Email')}); template result => { title => 'webapp', result2 => $r2 } }; true;
        You defined two "post" routes for '/'. How should Perl know which one to call? It also seems your "result" template handles totally different sets of keys. It might be easier to define two different templates.

        It's not clear what your form is supposed to do. What if the fields related to the first submit button are filled, but the the second submit button is clicked? BTW, you can use JavaScript to disable the fields under the non-selected radio button. That's not Perl related at all.

        Start from a simple example (haven't I already told you?). Google your questions first before asking here. You can have multiple submit buttons, but you need to name them to distinguish which one was clicked. This either is not a Perl related issue.

        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://11132906]
help
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found