[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] Hidden variable or Query String or Form for run mode access?


Sean Davis wrote:

On Nov 29, 2004, at 11:05 PM, Kasturirangan Rangaswamy wrote:
    I am declaring a hidden HTML variable in each screen as follows

    <INPUT TYPE=HIDDEN NAME='rm' VALUE='<TMPL_VAR
NAME='run_mode_value'>'>

    and am setting it's value in my Perl subroutine.

    Now, I actually constructed a 'Continue' link on each screen to
move to the next one like so:

    <a href="">Continue</a>

Links are completely independent of forms. So if a user clicks on a link, any information in a form (including hidden fields) are not sent for the next request. Just what is in the link's url.

    a. Now, I know I could call my instance script and pass it the
mode-param variable along with an appropriate value
       but I dont like the idea of a query string on my browser address
line.

    b. Also, I have not been using forms and dont want to if I can get
away with that!. So 'POST' is not an option either.


The whole point of using CGI (OK, not the whole point, but...) is to use forms to gather information from the user. Without forms, you can gather no information from the user; in addition, you cannot gather information from any hidden fields or anything else on the page. That said, if you want to pass any information from one invocation of your script to the next, you can use GET, POST, save the information on the server side or on the client side in a cookie. I would vote for doing what you are doing already, but you WILL need a form on your page if you want your script to be able to access the value. In other words, your script will ever see the INPUT tag above without it being within a form block. Try putting it in a form block to see if that does the trick. Also, your continue button then can be a simple submit button on the same form.

++


    Question is, if (a) and (b) are excluded, is any other way possible
for me to use 'Continue' (as a link) and a hidden
    variable to move to the next mode. Is there something in that HREF
link I may be missing?

You can't exclude both (a) and (b). If you don't want a messy/complicated url then you have to use POST. If you don't want to use POST then you have to use a GET request which will generate a messy url. Why don't you want to use POST? and why don't you want a query string on the brower's address bar? It's always one or the other unless you want to do some weird javascript stuff that takes the values you are getting from the user and stuffing them in cookies... which I would say is a bad idea.

--
Michael Peters
Developer
Plus Three, LP


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.