Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
December 17, 2012, 7:24 pm
rate this thread
s to update single records. It might look like this, with the convention th=
at [[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=3D"post" action=3D"update_pres" name=3D"pres_N">
<input type=3D"submit" value=3D"Update President N" />
I would like to do one of three things but quite frankly don't know how. Th=
is post is the culmination of a fairly long time flailing around, and I'd l=
ike a little help --- even if it's confirmation that what I want is not pos=
sible (which I'm beginning to suspect is the case.)
1. When the user clicks on the submit button, leave the user on the same pa=
ge but execute a script in the background that updates the underlying datab=
2. When the user clicks on the submit button, leave the user on the same pa=
ge 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 confirm=
s the update but then immediately returns to the prior page.
The problem is that the table has about 40,000 records, and there are about=
six filters, some of which have fifty or so options, and they all can be m=
ultiply 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 from=
a sweet innocent baby to a strapping adult man, and I need some help with =
to update single records. It might look like this, with the convention that
[[input text][submit N]] is an HTML form:
None of these really has anything to do with Perl/server side...
That last one and it would make for a poor user experience.
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....
This is straightforward. Just use the same logic as you would usually
use to keep the user on the same page, but before returning the response
fire off a background task to perform the update. Since you are using
CGI the most straightforward way to do this is to fork and perform the
update in the child.
This can only be done on the client side. The simplest way is to specify
target="_blank" on the <form> element. This will cause the whole form
submission to happen in a new window/tab, and the CGI can then return
whatever status information it likes.
This, again, can only be done client-side, but this time the
modification is to the page returned from the CGI rather than the page
which invokes it. The simplest way is to use <meta refresh>, but that
will make a fresh request for the previous page rather than simply going
back to it (so, for instance, the page will be redisplayed at the top,
and any form entry the user has done will be lost). An alternative is to
but doing this right requires a certain amount of care to ensure the
whole page has in fact loaded and been displayed to the user for a
reasonable amount of time before going back to the previous page.
As a general rule I hate sites which do this sort of thing. IMHO a
better option would be to provide a link on the page which either calls
window.history.back() or simply links to the previous page, which allows
the user to decide when they've finished reading the update page and
they want to return to the previous one.
An alternative I quite like is to display the status information inline,
close to the form the user has just operated, either using AJAX or by
redisplaying the whole page.
This is a completely different problem from the UI issue. You need a
real database: I would recommend Postgres.
- » Examining the existence of a hash key instantiates higher level keys
- — Next thread in » PERL Discussions
- » Company web-site (all perl CGI) re-design, suggestions?
- — Previous thread in » PERL Discussions