Go Back   CodingForums.com > :: Client side development > JavaScript programming

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 08-09-2007, 09:09 AM   PM User | #1
Codestar
New Coder

 
Join Date: Jul 2007
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Codestar is an unknown quantity at this point
Smarty template vars and Javascript functions

Hi there.

I've got a smarty loop (template side):

{section name=index loop=$productData}
<tr>
<td>{$productData[index].short}</td>
<td>{$productData[index].Omschrijving}</td>
<td>{$productData[index].Verkoopprijs}</td>
<td>
{$productData[index].Hoofdgroep}
(<a href="#" onclick="editProduct('{$productData[index]}');">Wijzig</a>)
</td>
<td><input type="checkbox" name="proI_{$productData[index].id}" id="PRO_{$productData[index].id}"></td>
</tr>
{/section}

Now I whould like to send the array {$productData[index]} to my Javascript function. But when I check my Javascript function editProduct(); using Firebug... the received parameter array is empty!

What to do, what to do?
Codestar is offline   Reply With Quote
Old 08-09-2007, 09:52 AM   PM User | #2
Codestar
New Coder

 
Join Date: Jul 2007
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Codestar is an unknown quantity at this point
I think I found the solution.

Doesn't look very pretty, but it works:

<td>
{$productData[index].Hoofdgroep}
(<a href="#" onclick="getData();">Wijzig</a>)
{literal}
<script type="text/javascript">
function getData() {
var productData = new Object();
productData.Id = '{/literal}{$productData[index].id}{literal}';
productData.Omschrijving = '{/literal}{$productData[index].Omschrijving}{literal}';
editProduct(productData);
}
</script>
{/literal}
</td>

Last edited by Codestar; 08-09-2007 at 09:58 AM..
Codestar 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:48 PM.


Advertisement
Log in to turn off these ads.