Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am coding a security incident tracking system for my work and I am running into a little problem. The problem is that the incident report has a number of field inputs throughout the form taking up lots of space - I need to split the incoming security report into its own window so that If need be it can be printed out w/o cutting off lots of important text. At the present moment I have been using javascript to create a new window, however, I need to pass the value from that textarea back to the parent window and have the parent update the database with all of the relevant information. I don't know if this is the right way to go, but if anyone has any suggestions on what I can do please do so. I appreciate the help.

Replies are listed 'Best First'.
(jcwren) Re: Separate window for security report
by jcwren (Prior) on Oct 11, 2000 at 00:01 UTC
    If you're already using JavaScript, you can set a variable in the parent window as the child window closes (or on the OnBlur event, when it loses focus). The variable that was set can then be passed to the CGI script with standard CGI techniques.

    The other non-JavaScript (and many would say better) way is simply to move to another page to enter that data, and return to the previous page when complete. You can maintain your state variables either be using hidden fields, or using one of the several state packages (or your own in a database, or the web server, or whatever. Just make sure you're not opening yourself to security issues, where someone can hack a variable and do some damage).

    There are a number of nodes on the site that talk about the various methods of maintaining state variables in a CGI environment. Type 'super search' in the search box at the top, and try words like 'state maintain', etc. You may have to do a little poking around to get a good hit.

    --Chris

    e-mail jcwren
Re: Separate window for security report
by Fastolfe (Vicar) on Oct 11, 2000 at 00:49 UTC
    You can refer to windows by name, so from your child window, just have your javascript access your form object(s) underneath this main window. I'm no JavaScript expert, but instead of doing something like this:
    myform.inputvar.value = 'whatever';
    do
    mainwindow.myform.inputvar.value = 'whatever';
    or whatever other objects you have to work with between 'mainwindow' and 'myform'. You may wish to consider consulting any of the thousands of JavaScript-oriented web sites on the 'Net for information on accessing objects in multiple windows.