473,661 Members | 2,506 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

avascript w/Perl question - Simple for most......


Hi All,

I have a form that uses Javascript to validate some fields. Whe the
user selects to submit the form with certain values selected, I want to
be able to execute a Perl script, query the MySQL database to get my
resuts and return an ALERT box to the user if his form input was
invalid.

Problem is, I do not want to change the screen. I just want the dialog
to pop up. I am very good at Perl, but I'm less than a novice at
Javascript. I was hoping that if someone had an exmple of this, they
could put it up and explain it to me........

Thanks,

Arthur

Jan 30 '06 #1
6 1689
am****@iwc.net wrote:
Hi All,

I have a form that uses Javascript to validate some fields. Whe the
user selects to submit the form with certain values selected, I want to
be able to execute a Perl script, query the MySQL database to get my
resuts and return an ALERT box to the user if his form input was
invalid.

Problem is, I do not want to change the screen. I just want the dialog
to pop up. I am very good at Perl, but I'm less than a novice at
Javascript. I was hoping that if someone had an exmple of this, they
could put it up and explain it to me........

Thanks,

Arthur

You would need to use XmlHTTPRequest to send all the form fields to a
perl page that can check the input against the database/validation
functions, and either return OK to submit, or return false for a
particular field name/number. This is also known as AJAX.
http://www.w3schools.com/xml/xml_http.asp

Or instead of doing all the form fields at once, you could to the
validation onblur for each form field. However, if the server response
is slow, this will probably be annoying.

Jan 30 '06 #2
jshanman said the following on 1/30/2006 3:01 PM:
am****@iwc.net wrote:
Hi All,

I have a form that uses Javascript to validate some fields. Whe the
user selects to submit the form with certain values selected, I want to
be able to execute a Perl script, query the MySQL database to get my
resuts and return an ALERT box to the user if his form input was
invalid.

Problem is, I do not want to change the screen. I just want the dialog
to pop up. I am very good at Perl, but I'm less than a novice at
Javascript. I was hoping that if someone had an exmple of this, they
could put it up and explain it to me........

Thanks,

Arthur

You would need to use XmlHTTPRequest to send all the form fields to a
perl page that can check the input against the database/validation
functions, and either return OK to submit, or return false for a
particular field name/number. This is also known as AJAX.
http://www.w3schools.com/xml/xml_http.asp


Why do people continue to make the mistake of thinking that
XMLHTTPRequest is the only way to do that? It's not. It is also not the
most widely supported way of doing it. One simple solution that comes to
mind is to submit a dummy form in a hidden IFrame and read the results
back from there.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 30 '06 #3

Randy Webb wrote:
jshanman said the following on 1/30/2006 3:01 PM:
am****@iwc.net wrote:
Hi All,

I have a form that uses Javascript to validate some fields. Whe the
user selects to submit the form with certain values selected, I want to
be able to execute a Perl script, query the MySQL database to get my
resuts and return an ALERT box to the user if his form input was
invalid.

Problem is, I do not want to change the screen. I just want the dialog
to pop up. I am very good at Perl, but I'm less than a novice at
Javascript. I was hoping that if someone had an exmple of this, they
could put it up and explain it to me........

Thanks,

Arthur

You would need to use XmlHTTPRequest to send all the form fields to a
perl page that can check the input against the database/validation
functions, and either return OK to submit, or return false for a
particular field name/number. This is also known as AJAX.
http://www.w3schools.com/xml/xml_http.asp


Why do people continue to make the mistake of thinking that
XMLHTTPRequest is the only way to do that? It's not. It is also not the
most widely supported way of doing it. One simple solution that comes to
mind is to submit a dummy form in a hidden IFrame and read the results
back from there.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Your right, its not the only way. Another way is outline in the
article linked below, which involved appending a child script that is
generated by a server page. The author claims that this is more
compatible then XmlHTTPRequest, however, it only supports GET requests.
Interesting technique, at least.

http://www.phpit.net/article/ajax-ph...mlhttprequest/

Jan 31 '06 #4
jshanman said the following on 1/31/2006 9:07 AM:
Randy Webb wrote:
jshanman said the following on 1/30/2006 3:01 PM:
am****@iwc.net wrote:
Hi All,

I have a form that uses Javascript to validate some fields. Whe the
user selects to submit the form with certain values selected, I want to
be able to execute a Perl script, query the MySQL database to get my
resuts and return an ALERT box to the user if his form input was
invalid.

Problem is, I do not want to change the screen. I just want the dialog
to pop up. I am very good at Perl, but I'm less than a novice at
Javascript. I was hoping that if someone had an exmple of this, they
could put it up and explain it to me........

Thanks,

Arthur

You would need to use XmlHTTPRequest to send all the form fields to a
perl page that can check the input against the database/validation
functions, and either return OK to submit, or return false for a
particular field name/number. This is also known as AJAX.
http://www.w3schools.com/xml/xml_http.asp Why do people continue to make the mistake of thinking that
XMLHTTPRequest is the only way to do that? It's not. It is also not the
most widely supported way of doing it. One simple solution that comes to
mind is to submit a dummy form in a hidden IFrame and read the results
back from there.


Your right, its not the only way. Another way is outline in the
article linked below, which involved appending a child script that is
generated by a server page.


Yes, and that page doesn't have a real good example of how to load
script files dynamically.
The author claims that this is more compatible then XmlHTTPRequest,
It is - when coded properly.
however, it only supports GET requests.
Ayup.
Interesting technique, at least.

http://www.phpit.net/article/ajax-ph...mlhttprequest/


Been doing that new "trick" for several years now.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 1 '06 #5
Randy Webb wrote:
jshanman said the following on 1/31/2006 9:07 AM:
Randy Webb wrote:
jshanman said the following on 1/30/2006 3:01 PM:
am****@iwc.net wrote:
> Hi All,
>
> I have a form that uses Javascript to validate some fields. Whe the
> user selects to submit the form with certain values selected, I want to
> be able to execute a Perl script, query the MySQL database to get my
> resuts and return an ALERT box to the user if his form input was
> invalid.
>
> Problem is, I do not want to change the screen. I just want the dialog
> to pop up. I am very good at Perl, but I'm less than a novice at
> Javascript. I was hoping that if someone had an exmple of this, they
> could put it up and explain it to me........
>
> Thanks,
>
> Arthur

You would need to use XmlHTTPRequest to send all the form fields to a
perl page that can check the input against the database/validation
functions, and either return OK to submit, or return false for a
particular field name/number. This is also known as AJAX.
http://www.w3schools.com/xml/xml_http.asp
Why do people continue to make the mistake of thinking that
XMLHTTPRequest is the only way to do that? It's not. It is also not the
most widely supported way of doing it. One simple solution that comes to
mind is to submit a dummy form in a hidden IFrame and read the results
back from there.
Your right, its not the only way. Another way is outline in the
article linked below, which involved appending a child script that is
generated by a server page.


Yes, and that page doesn't have a real good example of how to load
script files dynamically.
The author claims that this is more compatible then XmlHTTPRequest,


It is - when coded properly.
however, it only supports GET requests.


Ayup.
Interesting technique, at least.

http://www.phpit.net/article/ajax-ph...mlhttprequest/


Been doing that new "trick" for several years now.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Been doing that new "trick" for several years now.

You've also probably been programming for longer then I've been alive
:)

I've never used the iFrame method, but I've done a few tests to compare
the appendChild and XMLHttpRequest, which turned out to be equally
efficient for GET requests.

In your opinion, which way is better, the iframe, appendChild, or
XMLHttpRequest?

Feb 1 '06 #6
jshanman said the following on 2/1/2006 8:47 AM:
Randy Webb wrote:
<snip>
Been doing that new "trick" for several years now.

You've also probably been programming for longer then I've been alive
:)


<shrug> Possibly.
I've never used the iFrame method, but I've done a few tests to compare
the appendChild and XMLHttpRequest, which turned out to be equally
efficient for GET requests.
Did you test it in browsers that do not support XMLHTTPRequest? One
scenario that comes to mind is IE with ActiveX disabled but Scripting
enabled.
In your opinion, which way is better, the iframe, appendChild, or
XMLHttpRequest?


The IFrame is the most reliable and cross-browser if you are wanting to
do POST and GET's with Forms.

But it all goes back to what you are trying to accomplish. But to use
"AJAX" simply so you can say "Hey, I use AJAX" isn't using much brain
power.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 2 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5071
by: Sandman | last post by:
The subject says it all. I am doing a: I have a perl script in which I am using a ReadParse routine that parses the $ENV{'QUERY_STRING'} or $ENV{'CONTENT_LENGTH'} which are two variables passed to the script under usual SSI (.shtml) containing form data submitted to the page from which the script is executed from. Well, since switching to PHP, I have moved most of my perl scripts to php equivalents, but there are a few perl scripts...
58
4484
by: @ | last post by:
A benchmark in 2002 showed PHP is much slower in shell or when Apache has Mod_Perl. With the new PHP kissing Java's ass, Perl is once again the #1 CGI choice. Java is for a big team in short time to develope something slow. ASP is a joke. PHP is a kid.
42
4075
by: Fred Ma | last post by:
Hello, This is not a troll posting, and I've refrained from asking because I've seen similar threads get all nitter-nattery. But I really want to make a decision on how best to invest my time. I'm not interested on which language is better in *general*, just for my purpose. My area of research is in CAD algorithms, and I'm sensing the need to resort to something more expedient than C++, bash scripting, or sed scripting.
5
2068
by: howachen | last post by:
Currently I only use Ultra-Edit to write Javascript and debug using the firefox JS debugger. But as the project goes complex, I need to have a more advance editor, such as class/methods browsing, auto-complete, and maybe a build-in debugger if possible? I don't mind to pay for the editor, but what is the best editor now in the market?
3
2816
by: MarkW | last post by:
I hope this is the correct place to post this: I am developing a web site for a e-commerce business I will be running. The site I'm setting up will be 50% store, 50% content. I'm not sure which shopping cart I'll be using yet (am looking at os-commerce and miva) but the other part will be content. I will be writing reviews of products, articles on the industry, and someday may have some blogging and forums and advertising. As for perl,...
6
2994
by: surfivor | last post by:
I may be involved in a data migration project involving databases and creating XML feeds. Our site is PHP based, so I imagine the team might suggest PHP, but I had a look at the PHP documentation for one of the Pear modules for creating XML and it didn't look like much. I've used Perl XML:Twig and I have the impression that there is more Perl stuff available as well as the Perl stuff being well documented as I have a Perl DBI book, a Perl...
21
34385
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready equipped for uploading files via the CGI.pm module, which has long been a core module and allows users...
1
7183
KevinADC
by: KevinADC | last post by:
Introduction In part one we discussed the default sort function. In part two we will discuss more advanced techniques you can use to sort data. Some of the techniques might introduce unfamiliar methods or syntax to a less experienced perl coder. I will post links to online resources you can read if necessary. Experienced perl coders might find nothing new or useful contained in this article. Short Review In part one I showed you some...
1
47445
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or “save“. I’m going to show you how to do that using a perl script. What You Need Any recent...
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8343
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8762
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8545
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6185
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4179
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1992
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.