form submission to two pages (Perl, CGI, JavaScript)

Discussion in 'Perl Misc' started by ccc31807, Dec 17, 2012.

  1. ccc31807

    ccc31807 Guest

    I have a rather long list, perhaps named 'list_presidents' that allows users to update single records. It might look like this, with the convention that [[input text][submit N]] is an HTML form:

    1 | George Washington | [[input text][submit 1]]
    2 | John Adams | [[input text][submit 2]]
    3 | Thomas Jefferson | [[input text][submit 3]]
    4 | James Madison | [[input text][submit 4]]

    The form field looks like this:
    <form method="post" action="update_pres" name="pres_N">
    ....
    <input type="submit" value="Update President N" />
    </form>

    I would like to do one of three things but quite frankly don't know how. This post is the culmination of a fairly long time flailing around, and I'd like a little help --- even if it's confirmation that what I want is not possible (which I'm beginning to suspect is the case.)

    1. When the user clicks on the submit button, leave the user on the same page but execute a script in the background that updates the underlying database.

    2. When the user clicks on the submit button, leave the user on the same page but open a new page that confirms that the database has been updated.

    3. When the user clicks on the submit button, go to a new page that confirms the update but then immediately returns to the prior page.

    The problem is that the table has about 40,000 records, and there are aboutsix filters, some of which have fifty or so options, and they all can be multiply selected. It was a lot faster and simpler when I had just a couple of thousand records and a couple of simple filters, but this has grown froma sweet innocent baby to a strapping adult man, and I need some help with it.

    Thanks, CC.
    ccc31807, Dec 17, 2012
    #1
    1. Advertising

  2. ccc31807

    J. Gleixner Guest

    On 12/17/12 13:24, ccc31807 wrote:
    > I have a rather long list, perhaps named 'list_presidents' that allows users to update single records. It might look like this, with the convention that [[input text][submit N]] is an HTML form:
    >
    > 1 | George Washington | [[input text][submit 1]]
    > 2 | John Adams | [[input text][submit 2]]
    > 3 | Thomas Jefferson | [[input text][submit 3]]
    > 4 | James Madison | [[input text][submit 4]]
    >
    > The form field looks like this:
    > <form method="post" action="update_pres" name="pres_N">
    > ...
    > <input type="submit" value="Update President N" />
    > </form>
    >
    > I would like to do one of three things but quite frankly don't know how. [...]>


    None of these really has anything to do with Perl/server side...

    > 1. When the user clicks on the submit button, leave the user on the same page but execute a script in the background that updates the underlying database.
    >
    > 2. When the user clicks on the submit button, leave the user on the same page but open a new page that confirms that the database has been updated.
    >
    > 3. When the user clicks on the submit button, go to a new page that confirms the update but then immediately returns to the prior page.
    >

    That last one and it would make for a poor user experience.

    Read up on AJAX. A JavaScript framework, like JQuery, makes doing these
    things much easier than writing it yourself. There are many JavaScript
    libraries that you can choose from and they each simplify AJAX calls,
    going through the DOM, validating forms, dynamically show/hide
    elements, etc. Other popular libs: Ext JS, MooTools, Prototype,
    GWT, YUI, etc....

    See: http://en.wikipedia.org/wiki/Comparison_of_JavaScript_frameworks
    J. Gleixner, Dec 17, 2012
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel Rudy
    Replies:
    2
    Views:
    611
    Daniel Rudy
    Apr 28, 2008
  2. Toby Rodwell
    Replies:
    1
    Views:
    91
    Toby Rodwell
    May 13, 2007
  3. Jared
    Replies:
    5
    Views:
    195
    Jared
    Jul 10, 2003
  4. sam
    Replies:
    6
    Views:
    176
  5. kath
    Replies:
    4
    Views:
    535
    J. Gleixner
    Apr 9, 2007
Loading...

Share This Page