You are here: Re: Error trapping in Perl-generated page « HTML « IT news, forums, messages
Re: Error trapping in Perl-generated page

Posted by Ed Jay on 10/19/44 11:31

mbstevens <NOXwebmasterx@xmbstevensx.com> wrote:

>Ed Jay wrote:
>
>> Two questions:
>>
>> 1. How can I either test the error while still on Page 1?

>JavaScript, but you still need to test server side because this won't
>work for every visitor.

My audience is limited to subscribers to a service and one of the
conditions is that they must have javascript enabled. That said, am I to
presume a javascript to poll the answers to my two problematic questions
is what you're suggesting?

> If it gets to page 1 with bad values,
>regenerate the page with all but the bad values filled in, and a message
>added indicating values to be corrected.

Not difficult to do, except that the questions are answered with
checkboxes or radio boxes and without doing a ton of conditional tests for
each question, I don't know how else to show the state of each answer box.
>>
>> 2. How do I test for the Page 1 error on Page 2 and automatically return
>> the op to Page 1 for corrections?
>CGI.pm saves state. You'll probably be able to figure out what you need
>from looking at the following pages:
>
>http://www.foo.be/docs/tpj/issues/vol1_2/tpj0102-0004.html
>
>http://www.perl.com/doc/manual/html/lib/CGI.html#SAVING_THE_STATE_OF_THE_SCRIPT_T
>
>...and Google for "CGI.pm save state" for more.

Saving the state is trivial, except for the checkmarks in each answer
button.

In fact, the methods shown in the Perl docs seem to be a bit heavy. I read
in the variables, do the error checking, and if there's an error, I
resubmit to the original page with all the variables in hidden form
fields. It works fine, save those damned checkmarks.

As I type this, I just had a thought. Go to Page 2 (or a dedicated error
checking page) and check for the error. If the error exists, print the
error message and either use either <a href="javascript:history.back()">
or a message telling the op to use his browser's 'Back Button' to return
to Page 1. The complete state is save in the cache.

--
Ed Jay (remove M to respond by email)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация