Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

problem with SmartyFormTool

 
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
adamos
Smarty Rookie


Joined: 29 Dec 2004
Posts: 8
Location: Poland

PostPosted: Wed Dec 29, 2004 1:36 pm    Post subject: problem with SmartyFormTool Reply with quote

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
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7365
Location: Lincoln Nebraska, USA

PostPosted: Wed Dec 29, 2004 2:40 pm    Post subject: Re: problem with SmartyFormTool Reply with quote

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
View user's profile Send private message Visit poster's website
adamos
Smarty Rookie


Joined: 29 Dec 2004
Posts: 8
Location: Poland

PostPosted: Wed Dec 29, 2004 2:53 pm    Post subject: Re: problem with SmartyFormTool Reply with quote

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
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7365
Location: Lincoln Nebraska, USA

PostPosted: Wed Dec 29, 2004 3:02 pm    Post subject: Reply with quote

Do you have a URL for example? What browser(s) have you tried? What does the javascript console say in firefox?
Back to top
View user's profile Send private message Visit poster's website
adamos
Smarty Rookie


Joined: 29 Dec 2004
Posts: 8
Location: Poland

PostPosted: Thu Dec 30, 2004 9:30 am    Post subject: Reply with quote

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
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7365
Location: Lincoln Nebraska, USA

PostPosted: Thu Dec 30, 2004 3:03 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
adamos
Smarty Rookie


Joined: 29 Dec 2004
Posts: 8
Location: Poland

PostPosted: Mon Jan 03, 2005 8:22 am    Post subject: Reply with quote

thx Monte, with <form ... > is ok
_________________
> Wamp5 + AdoDB + Smarty
> CherryPy + Python + Cheetah
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP