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: Intermediate: Re: [mk3lai] Help with CGI.PM and javascript: Edit Log



FishMonger
Veteran / Moderator

Jun 18, 2010, 3:25 PM


Views: 3028
Re: [mk3lai] Help with CGI.PM and javascript

If you want to clean it up, then use a here doc instead of those messy print statements.

e.g.,

Code
my $javascript = <<"JS"; 
if (formdetail.detail.value == "") {
if (formsite.site.value == "") {
alert("You must enter a site or details")
formsite.site.focus();
return false;
}
$menu
JS

print $javascript;

# or if you feel that you want to use the cgi module
print $cgi->pre($javascript);


If you don't want to use a here doc, then do this.

Code
print qq(  if (formdetail.detail.value == "") {\n), 
qq( if (formsite.site.value == "") {\n),
qq( alert("You must enter a site or details")\n),
qq( formsite.site.focus();\n),
qq( return false;\n),
qq( }\n),
qq( $menu\n);



(This post was edited by FishMonger on Jun 18, 2010, 3:27 PM)


Edit Log:
Post edited by FishMonger (Veteran) on Jun 18, 2010, 3:27 PM


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

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