web wizard question

Discussion in 'Perl Misc' started by david, Sep 15, 2008.

  1. david

    david Guest

    Hi All,

    I wrote a web wizard with cgi which contains of a couple of 4 steps.
    In each step the user can go forward and backward. My problem was that
    the script has to remember what the user chose in each step. I thought
    about an option to send the selections from the other steps with
    hidden fields. This is a little tedious, so I decided to write the
    wizard with javascript. This solution has two problems. 1) All the
    steps have to be loaded from the beginning. 2) Accessibility issues.

    Is there a convenient solution for this in perl ?

    Thanks in advance,
    David
    david, Sep 15, 2008
    #1
    1. Advertising

  2. david <> writes:

    > In each step the user can go forward and backward. My problem was that
    > the script has to remember what the user chose in each step. I thought
    > about an option to send the selections from the other steps with
    > hidden fields.


    [...]

    > Is there a convenient solution for this in perl ?


    Look at CGI::Session (http://search.cpan.org/perldoc?CGI::Session)
    there is even a tutorial.

    //Makholm
    Peter Makholm, Sep 15, 2008
    #2
    1. Advertising

  3. david

    Guest

    david <> wrote:
    > Hi All,
    >
    > I wrote a web wizard with cgi which contains of a couple of 4 steps.
    > In each step the user can go forward and backward. My problem was that
    > the script has to remember what the user chose in each step. I thought
    > about an option to send the selections from the other steps with
    > hidden fields. This is a little tedious,


    I don't find it very tedious. Maybe I have low standards, or maybe you are
    doing it wrong. Can you show us some relevant code?

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    The costs of publication of this article were defrayed in part by the
    payment of page charges. This article must therefore be hereby marked
    advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
    this fact.
    , Sep 15, 2008
    #3
  4. david

    david Guest

    On Sep 15, 7:53 pm, wrote:
    > david <> wrote:
    > > Hi All,

    >
    > > I wrote a web wizard with cgi which contains of a couple of 4 steps.
    > > In each step the user can go forward and backward. My problem was that
    > > the script has to remember what the user chose in each step. I thought
    > > about an option to send the selections from the other steps with
    > > hidden fields. This is a little tedious,

    >
    > I don't find it very tedious.  Maybe I have low standards, or maybe youare
    > doing it wrong.  Can you show us some relevant code?
    >
    > Xho
    >
    > --
    > --------------------http://NewsReader.Com/--------------------
    > The costs of publication of this article were defrayed in part by the
    > payment of page charges. This article must therefore be hereby marked
    > advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
    > this fact.


    Now is my code not interesting because i make all the work in
    javascript and get a cgi, as i would not have a wizard. All the
    parameters are sent once. My problem was that i have to remember what
    i chose in each step. lets say if i have a wizard with 4 steps. I
    have in step 2 of the wizard a multiple select and i select there 5
    items. Then i go to step 3 and then back to step 2. the program has to
    remember the selection of step 2. I can make this with hidden fields
    where each control of every step is a hidden field. But in every step
    of the wizard i have to give in the html for every control of the
    other steps a hidden field
    This makes it tedious
    david, Sep 16, 2008
    #4
  5. david

    Bill H Guest

    On Sep 16, 3:25 am, david <> wrote:
    > On Sep 15, 7:53 pm, wrote:
    >
    >
    >
    >
    >
    > > david <> wrote:
    > > > Hi All,

    >
    > > > I wrote a web wizard with cgi which contains of a couple of 4 steps.
    > > > In each step the user can go forward and backward. My problem was that
    > > > the script has to remember what the user chose in each step. I thought
    > > > about an option to send the selections from the other steps with
    > > > hidden fields. This is a little tedious,

    >
    > > I don't find it very tedious.  Maybe I have low standards, or maybe you are
    > > doing it wrong.  Can you show us some relevant code?

    >
    > > Xho

    >
    > > --
    > > --------------------http://NewsReader.Com/--------------------
    > > The costs of publication of this article were defrayed in part by the
    > > payment of page charges. This article must therefore be hereby marked
    > > advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
    > > this fact.

    >
    > Now is my code not interesting because i make all the work in
    > javascript and get a cgi, as i would not have a wizard. All the
    > parameters are sent once. My problem was that i have to remember what
    > i  chose in each step. lets say if i have a wizard with 4 steps.  I
    > have in step 2 of the wizard  a multiple select  and i select there 5
    > items. Then i go to step 3 and then back to step 2. the program has to
    > remember the selection of step 2. I can make this with hidden fields
    > where each control of every step is a hidden field. But in every step
    > of the wizard i have to give in the html for every control of the
    > other steps a hidden field
    > This makes it tedious- Hide quoted text -
    >
    > - Show quoted text -


    Not perl but, use a hidden ilayer or div for each step. Enclose all
    the layers in the same form element, only show the layer they are on.
    That way all the form elements retain their values from one step to
    the other and you only have a single post back to the server when they
    are done.

    Bill H
    Bill H, Sep 16, 2008
    #5
  6. david

    Guest

    david <> wrote:
    >
    > Now is my code not interesting because i make all the work in
    > javascript and get a cgi, as i would not have a wizard. All the
    > parameters are sent once. My problem was that i have to remember what
    > i chose in each step. lets say if i have a wizard with 4 steps. I
    > have in step 2 of the wizard a multiple select and i select there 5
    > items. Then i go to step 3 and then back to step 2. the program has to
    > remember the selection of step 2. I can make this with hidden fields
    > where each control of every step is a hidden field. But in every step
    > of the wizard i have to give in the html for every control of the
    > other steps a hidden field
    > This makes it tedious


    use CGI;
    my $cgi=CGI->new;
    #.....
    print $cgi->hidden('param_name');

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    The costs of publication of this article were defrayed in part by the
    payment of page charges. This article must therefore be hereby marked
    advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
    this fact.
    , Sep 16, 2008
    #6
  7. david

    david Guest

    On Sep 16, 5:36 pm, wrote:
    > david <> wrote:
    >
    > > Now is my code not interesting because i make all the work in
    > > javascript and get a cgi, as i would not have a wizard. All the
    > > parameters are sent once. My problem was that i have to remember what
    > > i  chose in each step. lets say if i have a wizard with 4 steps.  I
    > > have in step 2 of the wizard  a multiple select  and i select there5
    > > items. Then i go to step 3 and then back to step 2. the program has to
    > > remember the selection of step 2. I can make this with hidden fields
    > > where each control of every step is a hidden field. But in every step
    > > of the wizard i have to give in the html for every control of the
    > > other steps a hidden field
    > > This makes it tedious

    >
    > use CGI;
    > my $cgi=CGI->new;
    > #.....
    > print $cgi->hidden('param_name');
    >
    > Xho
    >
    > --
    > --------------------http://NewsReader.Com/--------------------
    > The costs of publication of this article were defrayed in part by the
    > payment of page charges. This article must therefore be hereby marked
    > advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
    > this fact.


    Thanks, I think this will do the trick. Something like this.
    foreach my $param_name ($cgi->param) {
    print $cgi->hidden($param_name,$cgi->param($param_name));
    }
    david, Sep 17, 2008
    #7
  8. david

    Guest

    david <> wrote:
    > On Sep 16, 5:36=A0pm, wrote:
    > > david <> wrote:
    > >
    > > > But in
    > > > every step of the wizard i have to give in the html for every control
    > > > of the other steps a hidden field
    > > > This makes it tedious

    > >
    > > use CGI;
    > > my $cgi=3DCGI->new;
    > > #.....
    > > print $cgi->hidden('param_name');
    > >


    (please don't quote sigs. Sig snipped)

    > Thanks, I think this will do the trick. Something like this.
    > foreach my $param_name ($cgi->param) {
    > print $cgi->hidden($param_name,$cgi->param($param_name));
    > }


    I think the below should work:

    foreach my $param_name ($cgi->param) {
    print $cgi->hidden($param_name);
    }

    CGI.pm supports "sticky fields", which means if you used CGI both to
    parse the submitted form and print a new form, it automatically uses
    the values of just-parsed elements to populate the newly printed ones with
    the same name.

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    The costs of publication of this article were defrayed in part by the
    payment of page charges. This article must therefore be hereby marked
    advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
    this fact.
    , Sep 17, 2008
    #8
    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. Jimmy

    ASP.net 1.1 web wizard

    Jimmy, Jun 8, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    431
    Jimmy
    Jun 8, 2005
  2. Replies:
    0
    Views:
    596
  3. Darrel
    Replies:
    3
    Views:
    427
    MasterGaurav \(www.edujini-labs.com\)
    Oct 25, 2007
  4. Andy B
    Replies:
    0
    Views:
    432
    Andy B
    Apr 19, 2008
  5. Replies:
    1
    Views:
    220
    Roland Hall
    Sep 30, 2005
Loading...

Share This Page