Perl  with java popup

Posted on 2011-04-22
Last Modified: 2012-08-14
I have some Perl CGI pages where we use a few java pop ups, don't know much about java, I'm trying to add a check to a pop up but not getting what I want.

for example, I have a alert that pops up for this condition:

    if (document.forms[0].building_new.value != document.forms[0].building_orig.value) {
        alert("Please select a CITY xxxxx");
        return false;

This works fine as I can test it with does = or dose not =.

Problem I have is I need to check some other variables other than the building_new but I'm not getting any results, so does not look like they are even being defined as they should be but cannot tell.

For the example above, I know it's doing the compare but how can I print out the value of the building_new in my alert, I've tried to print "document.forms[0].building_new.value" but obviously that does not work, what is the format to print the value of:

I've seen examples such as using:  document.writeln  but I have not got it to work, I need to see how to print out what I'm looking at so I can figure out what is my problem with other checks I need to add.


Question by:bt707
    LVL 86

    Accepted Solution

    Have you tried iterating document.forms[0].elements?

    Author Comment

    I'm sure I'm not doing it right as I'm just guessing, I don't know very little about java.

    I tried putting in the alert to print

    alert("Please select a CITY xxxxx document.forms[0].elements");

    but that just print a pop up and the text of the pop up is:

    Please select a CITY xxxxx document.forms[0].elements

    I know that can't be right, but what do I need to do to print the elements, that would be good to have.

    Author Comment

    I did see what I was going wrong on part of it.

    If I just use:


    Then I do get the value of what's in building_new in my alert.

    How can I do a loop to print out all of the values that is in document.forms ?

    LVL 86

    Expert Comment

    >>How can I do a loop to print out all of the values that is in document.forms ?

    By doing what i suggested at http:#35449766
    LVL 86

    Expert Comment


    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System ( introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
    Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
    Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now