View Full Version : Greyed out 'Populate List From Array'
paul.casbourne361959
03-21-2011, 03:49 PM
I've been following the .pdf help guide featuring step by step instructions for the dynamic drop-downs, however i have stalled at step 4 on page 8.
I have two drop downs; a parent and child.
I have prepared the parent list as per page 6 and have created a dynamic array using the server behaviour WA Dynamic Drop-downs option.
Then with the parent still selected, I attempted to select 'Populate List From Array' from the WA Dynamic Array Drop-downs, but its greyed out so I can select.
I have to say, the instructions are not at all clear as they appear to combine instructions for both lists and menus, so its difficult to pull out the important steps for the drop down menu functionality.
Screen-grab attached illustrating issue.
Ideas welcome.
Thanks, Paul
Jason Byrnes
03-22-2011, 06:48 AM
at the top of the behaviors panel, what tag does it show as being selected? See the attached screen shot for an illustration of what I mean.
If you are still having a problem, please send a copy of your page.
paul.casbourne361959
03-22-2011, 02:29 PM
Hi, yes I have tag <select> present.
Page included as requested.
Thanks.
Jason Byrnes
03-23-2011, 08:32 AM
hmmm, seams to be an issue with templartes, I'll log this as a bug.
for a workaround, move the create dynamic array code that is at lines 102 - 148:;
<?php
if ($row_rsTowns) {
echo "<SC" . "RIPT>\n";
echo "var WAJA = new Array();\n";
$oldmainid = 0;
$newmainid = $row_rsTowns["Town_CountyID"];
if ($oldmainid == $newmainid) {
$oldmainid = "";
}
$n = 0;
while ($row_rsTowns) {
if ($oldmainid != $newmainid) {
echo "WAJA[".$n."] = new Array();\n";
echo "WAJA[".$n."][0] = '".WA_DD_Replace($newmainid)."';\n";
$m = 1;
}
echo "WAJA[".$n."][".$m."] = new Array();\n";
echo "WAJA[".$n."][".$m."][0] = "."'".WA_DD_Replace($row_rsTowns["Town_IDX"])."'".";\n";
echo "WAJA[".$n."][".$m."][1] = "."'".WA_DD_Replace($row_rsTowns["Town_Name"])."'".";\n";
$m++;
if ($oldmainid == 0) {
$oldmainid = $newmainid;
}
$oldmainid = $newmainid;
$row_rsTowns = mysql_fetch_assoc($rsTowns);
if ($row_rsTowns) {
$newmainid = $row_rsTowns["Town_CountyID"];
}
if ($oldmainid != $newmainid) {
$n++;
}
}
echo "var rsTowns_WAJA = WAJA;\n";
echo "WAJA = null;\n";
echo "</SC" . "RIPT>\n";
}
function WA_DD_Replace($startStr) {
$startStr = str_replace("'", "|WA|", $startStr);
$startStr = str_replace("\\", "\\\\", $startStr);
$startStr = preg_replace("/[\r\n]{1,}/", " ", $startStr);
return $startStr;
}
?>
to line 96 so it is just before the doctype tag so you can apply the populate list from array behavior. Move it back to line 102 after the populate list from array behavior is applied.
paul.casbourne361959
03-28-2011, 06:33 AM
Ok, so that workaround was successful.
The bug does seem to be connected with CS5 templates .dwt or dwt.php
The wizard works fine on plain .php pages. Would be interested to see if this can be fixed in next update.
Paul.
Jason Byrnes
03-28-2011, 07:17 AM
Glad to hear it is working.
I have logged the bug in our bug base so it will be addressed.
paul.casbourne361959
03-28-2011, 11:37 AM
Just realised that my child value is not retrieving from mysql.
Both parent and child are saving to their respecitive values to my DB, but only parent is retrieving the value.
Here is code for Child
<select name="mem_town" id="mem_town">
<option value="" <?php if (!(strcmp("", (str_replace('"', '"', $row_WAATKmembertbl['mem_town']))))) {echo "selected=\"selected\"";} ?>>Select town</option>
<?php
do {
?>
<option value="<?php echo $row_rsTowns['Town_IDX']?>"<?php if (!(strcmp($row_rsTowns['Town_IDX'], (str_replace('"', '"', $row_WAATKmembertbl['mem_town']))))) {echo "selected=\"selected\"";} ?>><?php echo $row_rsTowns['Town_Name']?></option>
<?php
} while ($row_rsTowns = mysql_fetch_assoc($rsTowns));
$rows = mysql_num_rows($rsTowns);
if($rows > 0) {
mysql_data_seek($rsTowns, 0);
$row_rsTowns = mysql_fetch_assoc($rsTowns);
}
?>
</select>
Am I missing something here?
Jason Byrnes
03-28-2011, 11:56 AM
is this on an update page then?
Please provide more details.
paul.casbourne361959
03-28-2011, 01:53 PM
This is on an update page.
When loaded, both drop-down dependencies populate ok
Parent and child data saves to sql db.
When user returns to update, only parent value is retrieved and displays.
The child drop-down is empty
Filer attached.
Jason Byrnes
03-28-2011, 02:21 PM
on an update page, you need to apply the Set Selected in list behavior for the parent list, and the populate list from array behavior for the child list to the body onlaod tag.
this can be problematic with a template though. with a template, you will need to apply the behaviors to another tag, then cut the code for the behavior and place it in a script tag at the lowest part of your page.
paul.casbourne361959
03-28-2011, 03:35 PM
Thank you.
That needs to be a little clearer in the pdf guides.
I've managed to complete this now.
Jason Byrnes
03-28-2011, 03:40 PM
glad to hear it is working.
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.