We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Perl  with java popup

Medium Priority
369 Views
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:
document.forms[0].building_new.value

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.

Thanks,



Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
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

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

If I just use:

alert(document.forms[0].building_new.value);

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 ?

Thanks,
CERTIFIED EXPERT
Top Expert 2016

Commented:
>>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
CERTIFIED EXPERT
Top Expert 2016

Commented:
:)
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.