CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
javascript code to pop up alert message, if drop down not selected.

 



sh.ajay12
User

Jun 13, 2014, 5:05 AM

Post #1 of 2 (5788 views)
javascript code to pop up alert message, if drop down not selected. Can't Post

Hello Members,

I am looking to insert the javascript code to pop up alert message, if drop down not selected in perl code.

also i want that the drop down should be validated and the options value should be passed to next cgi script.

Please help me out.

Many Thanks.


Zhris
Enthusiast

Jun 13, 2014, 9:08 AM

Post #2 of 2 (5627 views)
Re: [sh.ajay12] javascript code to pop up alert message, if drop down not selected. [In reply to] Can't Post

Hi,

Your thread would be better suited under the section "Throw Down The Gauntlet". We don't generally provide a code writing service, instead expect the poster to make an attempt and ask more specific questions with regards to issues encountered. Also the majority of your task is javascript based.

- use an onClick="return myfunction()" attribute in your select menu to call your javascript function, or if using a library such as jquery an onclick event handler.
- test if an option was selected. There are numerous ways to do this, searching this in Google will provide different solutions.
- alert("my message") if an option was not selected. Return false to ensure form submission is cancelled.
- any other validation can be performed in a similar manner to above. Don't forget you will need to validate both on client and server side, or on server side alone, never on client side alone.
- use CGI (https://metacpan.org/pod/CGI) and its param method in your Perl script to fetch the values of the options selected. For a more modern Perl approach use Plack.

Chris


(This post was edited by Zhris on Jun 13, 2014, 10:26 AM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives