How to extract info from a HTML input box

B

Blue Cat

I'm trying to write an HTML page with a PerlScript. Something like what you
see below. How do I do it?

<HTML>
<SCRIPT LANGUAGE = "PerlScript">
Sub DoSomething {
$a = [data recovered from an input box called txrNumber];
$b = [a mathematical operation with $a];
[Put $b into an input box called Result];
}
</SCRIPT>
<BODY>
<INPUT TYPE = TEXT NAME = "txtNumber" SIZE = 25>
<INPUT TYPE = BUTTON VALUE = "Click Me" onclick = "DoSomething()"> <BR>
<INPUT TYPE = TEXT NAME = "Result" VALUE = 0 SIZE = 25>
</BODY>
</HTML>
 
B

Ben Morrow

Blue Cat said:
I'm trying to write an HTML page with a PerlScript. Something like what you
see below. How do I do it?

<HTML>
<SCRIPT LANGUAGE = "PerlScript">
Sub DoSomething {
$a = [data recovered from an input box called txrNumber];
$b = [a mathematical operation with $a];
[Put $b into an input box called Result];
}
</SCRIPT>
<BODY>
<INPUT TYPE = TEXT NAME = "txtNumber" SIZE = 25>
<INPUT TYPE = BUTTON VALUE = "Click Me" onclick = "DoSomething()"> <BR>
<INPUT TYPE = TEXT NAME = "Result" VALUE = 0 SIZE = 25>
</BODY>
</HTML>

Umm... like that. For information on how to interact with the elements
on the page, see the documentation for JavaScript in IE and
translate. The object model is exactly the same.

Ben
 
B

Blue Cat

Ben Morrow said:
Blue Cat said:
I'm trying to write an HTML page with a PerlScript. Something like what you
see below. How do I do it?

<HTML>
<SCRIPT LANGUAGE = "PerlScript">
Sub DoSomething {
$a = [data recovered from an input box called txrNumber];
$b = [a mathematical operation with $a];
[Put $b into an input box called Result];
}
</SCRIPT>
<BODY>
<INPUT TYPE = TEXT NAME = "txtNumber" SIZE = 25>
<INPUT TYPE = BUTTON VALUE = "Click Me" onclick = "DoSomething()"> <BR>
<INPUT TYPE = TEXT NAME = "Result" VALUE = 0 SIZE = 25>
</BODY>
</HTML>

Umm... like that. For information on how to interact with the elements
on the page, see the documentation for JavaScript in IE and
translate. The object model is exactly the same.

Ben
I tried that and still got fatal errors.
 
C

Chris Mattern

Blue said:
Blue Cat said:
I'm trying to write an HTML page with a PerlScript. Something like what
you
see below. How do I do it?

<HTML>
<SCRIPT LANGUAGE = "PerlScript">
Sub DoSomething {
$a = [data recovered from an input box called txrNumber];
$b = [a mathematical operation with $a];
[Put $b into an input box called Result];
}
</SCRIPT>
<BODY>
<INPUT TYPE = TEXT NAME = "txtNumber" SIZE = 25>
<INPUT TYPE = BUTTON VALUE = "Click Me" onclick = "DoSomething()"> <BR>
<INPUT TYPE = TEXT NAME = "Result" VALUE = 0 SIZE = 25>
</BODY>
</HTML>

Umm... like that. For information on how to interact with the elements
on the page, see the documentation for JavaScript in IE and
translate. The object model is exactly the same.

Ben

I tried that and still got fatal errors.
If your problem is that you're getting fatal errors, why didn't you
say so in the first place? And you *still* haven't deigned to reveal
what errors in particular you're getting.

Chris Mattern
 
B

Blue Cat

This is a script I'm trying to replicate. It is from a paper "Active
Scripting with PERL" from MSDN:

<HTML>
<HEAD>
<TITLE>PerlScript Hello</TITLE>
<SCRIPT LANGUAGE = PerlScript>
sub pressed {
$elements = $form -> {elements};
$text = $elements->item(1);
$text->{value} = "Hello World";
$window->alert("Hi there, World");
}

</SCRIPT>
<BODY BGCOLOR = "#40A080">This is not a working Perl Script<BR>

<FORM NAME = "Form">
<INPUT TYPE = BUTTON VALUE = "Click Me" onclick = "pressed()"
LANGUAGE="PerlScript"><BR>
<INPUT TYPE = TEXT NAME = "boxtext" VALUE = "" SIZE = 25>
</FORM>
</BODY>
</HTML>

When I click the "Click Me" button, I get the message, "Can't call method
'item' on an undefined value at (eval 4) line 4". The script doesn't
execute. Obviously I'm dealing with something in this paper that I do not
understand.
 
T

Tad McClellan

Blue Cat said:
It is from a paper "Active
Scripting with PERL" from MSDN:


I would have more confidence in their code if they knew enough
to be able to spell the name of the language correctly...

It is "Perl", not "PERL".

Obviously I'm dealing with something in this paper that I do not
understand.


If only we knew what paper you are referring to, then we could
perhaps clear up your misunderstanding.

But we don't.

So we can't.
 
A

A. Sinan Unur

(e-mail address removed) (Tad McClellan) wrote in
If only we knew what paper you are referring to, then we could
perhaps clear up your misunderstanding.

But we don't.

So we can't.

It seems like the OP's referring to:

http://www.microsoft.com/mind/0897/perl.asp

What I can't figure out is why he is not willing to look at the examples
provided with AS Perl but would rather use 6 year old examples from MSDN.
OP: Please look in the C:\Perl\eg\IEExamples directory on your system.

Sinan.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,142
Messages
2,570,819
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top