Go Back   CodingForums.com > :: Server side development > Perl/ CGI

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-20-2009, 12:35 AM   PM User | #1
sudsey
New to the CF scene

 
Join Date: Apr 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
sudsey is an unknown quantity at this point
Javascript within CGI, onClick events

Hi I'm writing a CGI script that creats a HTML page. On the buttons the CGI script creates I need to invoke a function in the OnClick event. I need to call one function multiple times however I get the error " ')' expected " but the calling of the function works from the onclick event when I call it once. Here's the code that causes the error:
Code:
while (fgets(pref, 5, fp)) {
getc(fp); // space
fgets(ptype, 4, fp);
getc(fp); // space
fgets(pname, 56, fp);
getc(fp); // space
fgets(price, 7, fp);
getc(fp); // space
fgets(delay, 4, fp);
getc(fp); // space
fgets(stock, 4, fp);
getc(fp); // space
fgets(altref, 5, fp);
fgets(line, 80, fp); // trailing spaces and newline char
printf("<tr>");
printf("<td>"); printf(pname);
printf("<td>"); printf(ptype);
printf("<td>"); printf("£");printf(price);
printf("<td>"); printf("<input type='Button'id=%i value='View' align='middle' onclick='cat2(); cat(%s); cat(%s); cat(%s); cat(%s); cat(%s); cat(%s); cat(%s); cat1();'>",  temp, pref, pname, ptype, price, stock, delay, altref);  
printf("</td>");
printf("</tr>");
temp++;
}
The function I need to call mutilple times is cat(%s), is my syntax wrong?

Last edited by sudsey; 04-20-2009 at 12:44 PM.. Reason: grammer mistake
sudsey is offline   Reply With Quote
Old 04-20-2009, 04:09 PM   PM User | #2
FishMonger
Super Moderator


 
Join Date: May 2005
Location: Southern tip of Silicon Valley
Posts: 2,753
Thanks: 2
Thanked 149 Times in 144 Posts
FishMonger will become famous soon enoughFishMonger will become famous soon enough
sudsey,

You posted your question in the Perl forum, but that's not Perl code. Did you mean to post it in the php or Javascript forum?
FishMonger is offline   Reply With Quote
Old 04-20-2009, 06:05 PM   PM User | #3
sudsey
New to the CF scene

 
Join Date: Apr 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
sudsey is an unknown quantity at this point
I'm sorry but I thought this was perl/CGI?
My code is javascript embedded in CGI, hence why the code has to be within Printf statements,
sudsey is offline   Reply With Quote
Old 04-20-2009, 06:41 PM   PM User | #4
KevinADC
Senior Coder

 
Join Date: Mar 2006
Posts: 1,274
Thanks: 2
Thanked 39 Times in 38 Posts
KevinADC is on a distinguished road
Its still a javascript question. Perl can only generate the document that the javascript is embedded in, like an html document. But it has nothing to do with execution of the javascript, whcih is the browsers responsibility. It would only be a perl/CGI question if the perl code was having a problem. Does the javascript work if you just copy and paste it into a static html page?
KevinADC is offline   Reply With Quote
Old 04-21-2009, 10:54 AM   PM User | #5
sudsey
New to the CF scene

 
Join Date: Apr 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
sudsey is an unknown quantity at this point
No, it doesn't. It's serverside. Don't Worry problem solved.
sudsey is offline   Reply With Quote
Old 04-21-2009, 01:07 PM   PM User | #6
oesxyl
Master Coder


 
Join Date: Dec 2007
Posts: 6,682
Thanks: 436
Thanked 890 Times in 879 Posts
oesxyl is a jewel in the roughoesxyl is a jewel in the roughoesxyl is a jewel in the rough
Quote:
Originally Posted by sudsey View Post
I'm sorry but I thought this was perl/CGI?
My code is javascript embedded in CGI, hence why the code has to be within Printf statements,
Quote:
Originally Posted by sudsey View Post
No, it doesn't. It's serverside. Don't Worry problem solved.
you don't know what language is but is solved? that's weird.

regards
oesxyl is offline   Reply With Quote
Old 04-21-2009, 05:06 PM   PM User | #7
KevinADC
Senior Coder

 
Join Date: Mar 2006
Posts: 1,274
Thanks: 2
Thanked 39 Times in 38 Posts
KevinADC is on a distinguished road
Quote:
Originally Posted by sudsey View Post
No, it doesn't. It's serverside. Don't Worry problem solved.
If you say so.
KevinADC is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:36 AM.


Advertisement
Log in to turn off these ads.