Forum Moderators: coopster

Message Too Old, No Replies

Collapse state saved to cookie

Save my Dog

         

slipp

1:58 pm on Dec 14, 2007 (gmt 0)

10+ Year Member



So I snagged this script from a zip off a dev blog. I popped that directory on my server and the demo worked just fine. I'm trying to impliment it in a PHP app I built and I can't for the life of me get this to work... The collapse functionality works but on refresh the display setting is not preserved. It looks like the cookie is not set properly.

I've been comparing the source code of my app to the demo and I can't see any reason why it doesn't work. The only thing that is really different is that in my code my ID field is generated dynamically by looping through a SQL result set. And my Javascript function calls a written by print/echo statements Like this:

print"\r\r<!-- BEGIN EXCHANGE -->";
print "\r<tr id=\"Trader".$Trader."\" style=\"";
echo getState('Trader".$Trader."');
print "\"><td colspan=\"9\" rowspan=\"1\">";
print "\r<table style=\"text-align: left; width: 100%;\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\"><tbody>";

which generates code in the Source that looks fine to me:

<!-- BEGIN EXCHANGE -->
<tr id="TraderJTS" style="display:none;"><td colspan="9" rowspan="1">
<table style="text-align: left; width: 100%;" border="0" cellpadding="2" cellspacing="2"><tbody>

Here is the value of the cookie:

TraderJTS1%3D1%2C%25TraderRWD1%3D1%2C%25TraderDPK1%3D1%2CDPKCME%3D1%2CDPKICE_IPE%3D1%2Cobj1%3D1%
2CTraderEVT%3D1%2CTraderJTS1%3D1%2CTraderJTS1%3D1%2CTraderMHR1%3D1%2CTraderJCR1%3D1%2CTraderJTS1%
3D1%2CJTSCME1%3D1%2CTraderJTS1%3D1%2CTraderNMY%3D1%2CTraderGSR%3D1%2CTraderJMY%3D1%2CTraderJJE%3D1 %2CTraderDPK%3D1%2CTraderMBS%3D1%2CTraderJCR%3D1%2CTraderMHR%3D1%2CTraderJTS1%3D1%2CJTSCMECL%3D1 %2CJTSCMEHO%3D1%2CTraderJTS%3D1%2CJTSCME%3D1%2CJTSCMERB%3D1%2CJTSICE_IPE%3D1%2CJTSICE_IPEICE %20WTI%3D1%2C

It looks like the % are popping up in the wrong place... Any idea how to fix this.

________________________________________________________

Here are the included javascripts and php in case you are curious. This does seem to work with the demo so I don't think the problem is here.

[edited by: jatar_k at 3:00 pm (utc) on Dec. 15, 2007]
[edit reason] Removed unnecessary code [/edit]

slipp

3:00 pm on Dec 14, 2007 (gmt 0)

10+ Year Member



I figured it out! Wow that took way too long. I hate to be
stuck like that but sometimes putting the problem on ice for a day is
the best approach to finding a solution. I should have done that
yesterday instead of pulling my hair out ><

This:

$E = 0;

> print "\r\r<!-- BEGIN EXCHANGE -->";
> print "\r<tr id=\"Trader".$Trader."\" style=\"";
> echo getState('Trader".$Trader."');
> print "\"><td colspan=\"9\" rowspan=\"1\">";
> print "\r<table style=\"text-align: left; width: 100%;\" border=
> \"0\" cellpadding=\"2\" cellspacing=\"2\"><tbody>";

Needed to be:

$E = 0;
$TraderID = "Trader".$Trader;
echo "\r\r<!-- BEGIN EXCHANGE -->";
echo "\r<tr id=\"Trader".$Trader."\" style=\"";
echo getState($TraderID);
echo "\"><td colspan=\"9\" rowspan=\"1\">";
echo "\r<table style=\"text-align: left; width: 100%;\" border=\"0\"
cellpadding=\"2\" cellspacing=\"2\"><tbody>";