You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Simon Taylor <se...@nortelnetworks.com> on 2003/11/11 14:08:08 UTC

[users@httpd] Cgi Script using Javascript Calendar

Hi,

I have been traversing the learning curve of Apache, CGI and Javascript this
week. I hope this isn't too much of a newbie question.

What works:-

<FORM name="simon_form">
&nbsp;Date Field: <input name="simon" value="" size="11"><a
href="javascript:void(0)"
onclick="gfPop.fPopCalendar(document.simon_form.simon);return fal
se;" HIDEFOCUS><img name="popcal" align="absmiddle" src="js/calbtn.gif"
width="34" height="22" border="0" alt=""></a>
</FORM>

<iframe width=174 height=189 name="gToday:normal:agenda.js"
id="gToday:normal:agenda.js" src="ipopeng.htm" scrolling="no"
frameborder="0" style="visibi
lity:visible; z-index:999; position:absolute; left:-500px; top:0px;">
</iframe>

In a file - when all the other components are in the same directory.

What doesn't work is when I try to use Perl CGI::Formbuilder and Template
Toolkit to autogenerate a page with this Javascript Calendar widget on it.
Apache doesn't like trying to read the html and css components if they are
in the cgi-bin directory.

[Tue Nov 11 10:33:40 2003] [error] (8)Exec format error: exec of
/export/www/devel/htdocs/www-default/cgi-bin/ipopeng.htm failed

I tried moving them out to another directory and changing the URL's in the
script to reference them but as soon as I do it the javascript doesn't
function. Mozilla renders the page and IE5 doesn't render at all - but
neither throw an error message.
Whats the correct approach for setting up and executing Javascript from
within a cgi script?
Thanks


Simon Taylor
Managed Services Technology Consultant
Nortel Networks
p -  01279 404289 (ESN 742 4289)
m - 07740 533743 (ESN 748 3743)
e -  set@nortelnetworks.com

"I code therefore I am"


Re: [users@httpd] Cgi Script using Javascript Calendar

Posted by Nikolaus Schmitt <n....@scaet.de>.
Cgi Script using Javascript CalendarSimon,

separate "static" and "dynamic" content.
Put the cgi (server parsed html) into cgi-bin.
Put images, css files, js files somewhere below "htdocs" e.g. "htdocs/my_project_context_storage_dir"

Refer to the css file(s) by declaring one or more "link" elements into the SHTMLs header.
 <link rel="stylesheet" href="my_project_context_storage_dir/css/generic.css" type="text/css">

Refer to the js file(s) by declaring one or more "ccript" elements into the SHTMLs header.
<script language="JavaScript" type="text/javascript" src="my_project_context_storage_dir/js/generic.js"/>

Implement JavaScript functions "browser model and version aware". Not any function works with any browser. You'll find lot's of samples by browsing various scriptig and site building resources throughout the web.

Use a tracing utililty to figuere out what results the server renders in different situations. You can use "curl" or "wget" (unix command line) for this, or you could try to use a tool named "http tracer".

Everything looks right (nearly):
 - apache works
 - cgi execution works
 - no security or accessibility harms

There are just some issues on assembling HTML dynamically. 
Probably, another forum might be more helpful for You on this one?

Regards
Niko
  ----- Original Message ----- 
  From: Simon Taylor 
  To: 'users@httpd.apache.org' 
  Sent: Tuesday, November 11, 2003 2:08 PM
  Subject: [users@httpd] Cgi Script using Javascript Calendar


  Hi, 

  I have been traversing the learning curve of Apache, CGI and Javascript this week. I hope this isn't too much of a newbie question.

  What works:- 

  <FORM name="simon_form"> 
  &nbsp;Date Field: <input name="simon" value="" size="11"><a href="javascript:void(0)" onclick="gfPop.fPopCalendar(document.simon_form.simon);return fal

  se;" HIDEFOCUS><img name="popcal" align="absmiddle" src="js/calbtn.gif" width="34" height="22" border="0" alt=""></a> 
  </FORM> 

  <iframe width=174 height=189 name="gToday:normal:agenda.js" id="gToday:normal:agenda.js" src="ipopeng.htm" scrolling="no" frameborder="0" style="visibi

  lity:visible; z-index:999; position:absolute; left:-500px; top:0px;"> 
  </iframe> 

  In a file - when all the other components are in the same directory. 

  What doesn't work is when I try to use Perl CGI::Formbuilder and Template Toolkit to autogenerate a page with this Javascript Calendar widget on it. Apache doesn't like trying to read the html and css components if they are in the cgi-bin directory.

  [Tue Nov 11 10:33:40 2003] [error] (8)Exec format error: exec of /export/www/devel/htdocs/www-default/cgi-bin/ipopeng.htm failed

  I tried moving them out to another directory and changing the URL's in the script to reference them but as soon as I do it the javascript doesn't function. Mozilla renders the page and IE5 doesn't render at all - but neither throw an error message.

  Whats the correct approach for setting up and executing Javascript from within a cgi script? 
  Thanks 



  Simon Taylor 
  Managed Services Technology Consultant 
  Nortel Networks 
  p -  01279 404289 (ESN 742 4289) 
  m - 07740 533743 (ESN 748 3743) 
  e -  set@nortelnetworks.com 

  "I code therefore I am"