View previous topic :: View next topic |
Author |
Message |
adamos Smarty Rookie
Joined: 29 Dec 2004 Posts: 8 Location: Poland
|
Posted: Wed Dec 29, 2004 1:36 pm Post subject: problem with SmartyFormTool |
|
|
I have a problem with this tool:
1. I assign a table $colors to the template
$colors[0]= "red";
$colors[1]= "yellow";
$smarty->assign("colors", $colors);
$smarty->display('formtool.tpl');
2. In my template a have:
{formtool_init src="../javascripts/formtool.js"}
{include_php file="../javascripts/formtool.js" } // check path
{formtool_checkall name="colors[]"}
{html_checkboxes name="colors" values=$colors output=$colors separator="<br />"}
And when I submit form Status Bar send message "Error on This Page" = error JS.
I checked path to the formtool.js and i think its true, because when I indlude this file (include_php) page is displaing listing of formtoll.js
javascripts/formtool.js I drop to my Document_Root
I dont know why this don work, any idea ??? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Dec 29, 2004 2:40 pm Post subject: Re: problem with SmartyFormTool |
|
|
adamos wrote: | 2. In my template a have:
{formtool_init src="../javascripts/formtool.js"} |
This needs to be relative to document root, so probably:
{formtool_init src="/javascripts/formtool.js"}
adamos wrote: | {include_php file="../javascripts/formtool.js" } // check path |
?? include_php will try to directly include a PHP script relative to the executing PHP script. |
|
Back to top |
|
adamos Smarty Rookie
Joined: 29 Dec 2004 Posts: 8 Location: Poland
|
Posted: Wed Dec 29, 2004 2:53 pm Post subject: Re: problem with SmartyFormTool |
|
|
When I use
Code: | {formtool_init src="/javascripts/formtool.js"} |
the efect is the same " Error on This Page"
I used even code from formtool_init()
Code: | <script type="text/javascript" language="JavaScript" src="/javascripts/formtool.js">
</script> |
path to the foormtool is true so what is wrong ?? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Dec 29, 2004 3:02 pm Post subject: |
|
|
Do you have a URL for example? What browser(s) have you tried? What does the javascript console say in firefox? |
|
Back to top |
|
adamos Smarty Rookie
Joined: 29 Dec 2004 Posts: 8 Location: Poland
|
Posted: Thu Dec 30, 2004 9:30 am Post subject: |
|
|
I have:
DOCUMENT_ROOT
\formtool
--\formtoll.php
--\templates
----\formtoll.tpl
\javascript
formtool.php code:
[php:1:5ff7eeebec]<?php
require('smarty/Smarty.class.php');
$smarty =& new Smarty;
$smarty->compile_dir = 'templates/templates_c';
$smarty->template_dir = 'templates/templates';
$colors[0]= "red";
$colors[1]= "yellow";
//var_dump($colors);
$smarty->assign("colors", $colors);
$smarty->display('formtool.tpl');
?>[/php:1:5ff7eeebec]
formtool.tpl code:
Code: | {formtool_init src="/javascripts/formtool.js"}
{formtool_checkall name="colors[]"}
{html_checkboxes name="colors" values=$colors output=$colors separator="<br />"} |
I use IE5.5, 6 in Mozilla Java Console send error: this.form has no propeities |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Dec 30, 2004 3:03 pm Post subject: |
|
|
You probably need a form:
Code: | {formtool_init src="/javascripts/formtool.js"}
<form method="post" action="">
{formtool_checkall name="colors[]"}
{html_checkboxes name="colors" values=$colors output=$colors separator="<br />"}
</form> |
|
|
Back to top |
|
adamos Smarty Rookie
Joined: 29 Dec 2004 Posts: 8 Location: Poland
|
Posted: Mon Jan 03, 2005 8:22 am Post subject: |
|
|
thx Monte, with <form ... > is ok _________________ > Wamp5 + AdoDB + Smarty
> CherryPy + Python + Cheetah |
|
Back to top |
|
|