#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    78
    Rep Power
    12

    Perl w/ Javascript problems


    I have an HTML frameset page with 2 frames. In the left frame, I have a menu containing several buttons. For each button I have an "Onclick" event that calls the Javascript window.open() function. Basically, this function just loads the results of a Perl script (*.pl) into the right frame.

    For example, the button to add a customer calls:
    window.open("AddCustomerToDatabase.pl", "right frame");

    I also have a "show all customers" button that loads another Perl script which will retrieve all customers from a database and display them in nice table on the screen. This script also loads into the right frame, replacing the existing content.

    The problem I have is that I notice that the window.open() function does not load a FRESH page. (Evidently, I dont see the IE status/progress bar at the bottom showing any activity).

    For example, first I click "show all customers" and I see a table with 4 customers. Then I click "add customer" which loads a form (into the same right frame) in which I fill out the new customer information, and then submit it. Then when I click "show all customers" again, I still see the same table with only 4 customers, and not 5. Only when I click IE's "refresh" button will the updated table be displayed. I am using MySQL database, and I am positive that the submitted customer info is updated in the database immediately when i clicked submit. (I have checked that).

    I find it weird that window.open() doesnt load a fresh page each time. It only loads a fresh page during that page's first load. Can someone suggest me a way to force a fresh load each time?

    I thought about using window.location = http://blahblahblah.pl, but then there is no way to specify the target frame. Please help. Thanks.
  2. #2
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69

    Oh ok..


    Mmmm, surly this is a Javascript question, or at least a html Question? You don't need to use Javascript to interact with frames by the way, it seems that you could do what your trying to do here with html links and then you don't have to worry about browser compatabilities, there's less code and it's easier.

    Have fun,
    Mark.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    78
    Rep Power
    12
    Actually, I mentioned above that I used buttons just to make my explanation more simple. But I guess, it wasnt a good idea. Ok, so here's what I am REALLY trying to do.

    My Menu.html (in left frame) has 2 sets of radio buttons:

    @ 1 O A
    O 2 @ B
    O 3 O C

    Each radio button has an onClick event that calls the same Javascript code when triggered. The code will load a different Perl script (using windows.open()) depending which radio button is selected for EACH of the two columns (sets). Therefore, there are a total of 3^2 = 9 different Perl scripts that I have.

    Example:
    Currently, script 1B.pl is currently loaded in the right frame and shown on the screen because 1 and B were selected. Now, when I click on C, script 1C.pl should be loaded. After that, if I click on 3, then script 3C.pl should load. And so on...

    This is why I cannot use regular HTML links for this purpose.
  6. #4
  7. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Yeah sure, i see that you cant use html now but, this is still not a perl question mate, you may be loading a perl script but the question itself is a Javascript question. Ask this again in the "HTML, JavaScript & CSS", you might get a for useful answer

    Sorry,

    Take care,
    Mark.

IMN logo majestic logo threadwatch logo seochat tools logo