I know what the problem is.
Here's where it's occurring:
Code:
[!]results_array = response.split("~@~")[/!];
// Note: these PHP variables (below) can dynamically change after this form loads, therefore,
// in order for the form to reflect these changes, we have to update the PHP variables in
// the php ajax script and then pass them back to this form via JS's "Ajax Data Tunnel".
var table_structure = results_array[0];
var tag_email_chk = [!]results_array[1][/!];
var tag_phone_chk = [!]results_array[2][/!];
var tag_voice_chk = [!]results_array[3][/!];
var tag_fax_chk = [!]results_array[4][/!];
var tag_done_chk = [!]results_array[5][/!];
var tag_links_state = results_array[6];
When calling the split method, it takes the string and turns it into an array. However, it turns it into an array of strings. This means that if you split "1|2|3|4" on the | character, you'll get an array of 1, 2, 3, and 4. However, this is the string representation of these numbers, not the numeric values themselves. This means that if you added the first and second elements of that array together you'd get "12" instead of 3.
What this means for you is that the boolean values you're putting into the results_array aren't boolean values at all, they're string representations of the boolean values. So, it's putting
"false" in the array, not
false. For the problem I illustrated above there's an easy fix - javascript has functions called parseInt and parseFloat to turn strings into numeric values, but no such function exists for booleans.
However, not all hope is lost. All we have to do is create a new boolean object when the values are assigned from the array. To do this we encapsulate the value in the boolean object constructor, and all is right with the world
Code:
results_array = response.split("~@~");
// Note: these PHP variables (below) can dynamically change after this form loads, therefore,
// in order for the form to reflect these changes, we have to update the PHP variables in
// the php ajax script and then pass them back to this form via JS's "Ajax Data Tunnel".
var table_structure = results_array[0];
var tag_email_chk = [!]Boolean([/!]results_array[1][!])[/!];
var tag_phone_chk = [!]Boolean([/!]results_array[2][!])[/!];
var tag_voice_chk = [!]Boolean([/!]results_array[3][!])[/!];
var tag_fax_chk = [!]Boolean([/!]results_array[4][!])[/!];
var tag_done_chk = [!]Boolean([/!]results_array[5][!])[/!];
var tag_links_state = results_array[6];
-kaht
Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P>
<.</B>[/small]