Hello, I'm a relative newbie to CGI::App, H::T and JavaScript. I'm working on a project where I make heavy use of both CGI::App and H::T and limited use of JavaScript (just event handlers.) Recently, I devised an idiom for passing CGI parameters from one form to another form (without using any statefull server mechanism) and I'd like to pass it along. Maybe this is useful and you like it, maybe I've just devised something that everybody already knows about, or maybe you do this another way you'd like to share. Or more dreadfully, maybe there's a serious flaw in all this that I've overlooked! I'd really appreciate knowing about that before I spread this like molasses over my whole application.
Here are the key parts: Some HTML template looks like this ... <form id=new_data_form name=new_data_form method=post action=myapp.cgi?rm=new_data> <input type=hidden name="rm" value="add_record"> <input type=hidden name="param1"> <input type=hidden name="param2"> </form> <form id=edit_data_form name=edit_data_form method=post action=myapp.cgi?rm=edit_data> <input type=hidden name="rm" value="edit_record"> <input type=hidden name="param1"> <input type=hidden name="param2"> </form> <form id=instant_update_form name=instant_update_form method=post action=myapp.cgi> <input type=hidden name="rm" value="display"> <input type=hidden name="param1"> <input type=hidden name="param2"> <input type=hidden name="param3"> </form> <form id=main_form name=main_form method=post action=myapp.cgi> SOME HTML::Template structure here with ... <input type=text name="param3"> onClick="javascript:add_record()" .... and so on </form> And the Javascript .... function add_record() { var my_form; var somevar; my_form = this.document.forms['new_data_form']; somevar = this.document.forms['main'].param3.value; my_form.param1.value = "add"; my_form.param3.value = somevar; /* this is where it happens */ my_form.submit(); } and so on for other main display form functions. Then in the next form, on submit, pass all the cgi params back to myapp.cgi?rm=display and finally process. That's it. Hope you find it useful or care to share something even better. Cheers, Bill --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.506 / Virus Database: 303 - Release Date: 8/1/2003 ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ Html-template-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/html-template-users