Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Dec 2010
    Posts
    25
    Thanks
    16
    Thanked 0 Times in 0 Posts

    can you call a subroutine via a Form Action

    Is it possible to write HTML form in perl so that the action points to a subroutine in the same script?

    E.g.print "<form action=\"do_something()\">";where do_something is a subroutine?
    Last edited by toolglutton; 05-12-2011 at 11:18 PM.

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by toolglutton View Post
    Is it possible to write HTML form in perl so that the action points to a subroutine in the same script?

    E.g.print "<form action=\"do_something()\">";where do_something is a subroutine?
    no. why do you need this? i mean why do you want an explicit call of a sub from html instead of calling the script?

    best regards

  • Users who have thanked oesxyl for this post:

    toolglutton (05-12-2011)

  • #3
    New Coder
    Join Date
    Dec 2010
    Posts
    25
    Thanks
    16
    Thanked 0 Times in 0 Posts
    That way, I can keep all the subroutines in one cgi file. Plus, I need dynamic html.

    This should be something really simple. I can not imagine that it can not be achieved in Perl.


    Quote Originally Posted by oesxyl View Post
    no. why do you need this? i mean why do you want an explicit call of a sub from html instead of calling the script?

    best regards

  • #4
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by toolglutton View Post
    That way, I can keep all the subroutines in one cgi file. Plus, I need dynamic html.

    This should be something really simple. I can not imagine that it can not be achieved in Perl.
    is not the perl problem, you can't do this no matter what language you use because action attribute of the form must point to a url not to a given piece of code.
    anyway i don't see the problem with keeping all subs in a single file and if you want dynamic html pages calling one or another sub from the file is a mater of dispatch, very easy to do using perl.
    if you have a specific problem, preferably simple, is probably more easy to show how can be done.

    best regards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •