close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Dynamic Dropdowns on Update Record Page

Thread began 4/08/2009 2:15 pm by jendanko336232 | Last modified 4/09/2009 12:43 pm by jendanko336232 | 7445 views | 8 replies |

jendanko336232Beta Tester

Dynamic Dropdowns on Update Record Page

Is there a trick to using the dynamic dropdowns on an update record page? When i apply the behavior, the drop down menu will not display the current value in the database. Can you tell me how I can do this?

Sign in to reply to this post

Ray BorduinWebAssist

You can use the dreamweaver properties window and the "dynamic" button to set the correct value in the first list, and use the behavior "set selected in list" in the body onload event to set the value of the child list.

Sign in to reply to this post
Did this help? Tips are appreciated...

jendanko336232Beta Tester

Must be doing somthing wrong

It still does not work. Here is my code:

<body onload="WA_setSelectionsInChildList(MM_findObj('ProductCategoryID'),<?php echo $row_WADAProducts['ProductCategoryID']; ?>)">
<div id="outerWrapper">
<div id="header">
<h1><img src="../images/WDC_Logo_200.png" alt="Warehouse Discount Center Logo" width="200" height="92" /> <span class="style2">Administrator Control Panel</span></h1>
<hr />
</div>
<div id="topNavigation">
<?php require_once("../CSSMenuWriter/cssmw_admin/menu.php"); ?>
<script type="text/javascript">if(window.attachEvent) { window.attachEvent("onload", function() { cssmw_admin.intializeMenu('cssmw_admin'); }); } else if(window.addEventListener) { window.addEventListener("load", function() { cssmw_admin.intializeMenu('cssmw_admin'); }, true); }</script>
</div>
<div id="contentWrapper">
<div id="content">



<div class="WADAUpdateContainer">
<?php if ($totalRows_WADAProducts > 0) { // Show if recordset not empty ?>
<form action="Products_Update.php?ProductID=<?php echo(rawurlencode($row_WADAProducts['ProductID'])); ?>" method="post" enctype="multipart/form-data" name="WADAUpdateForm" id="WADAUpdateForm" >
<div class="WADAHeader">Update Record</div>
<div class="WADAHorizLine"><img src="../WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="WADADataTable">
<tr>
<th class="WADADataTableHeader">Available Online:</th>
<td class="WADADataTableCell"><input <?php if (!(strcmp((isset($_GET['valid'])?ValidatedField("ProductsUpdate","ProductLive"):$row_WADAProducts['ProductLive']),1))) {echo "checked=\"checked\"";} ?> name="ProductLive" type="checkbox" id="ProductLive" value="1" />
(check to make this item avaiable for sale)</td>
</tr>
<tr>
<th class="WADADataTableHeader">Item Type:</th>
<td class="WADADataTableCell"><label>
<select name="SuperClass" id="SuperClass" onchange="WA_FilterAndPopulateSubList(ProductCategoryList_WAJA,MM_findObj('Class'),MM_findObj('ProductCategoryID'),0,0,false,': ')">
<option value="appliances" <?php if (!(strcmp("appliances", $row_WADAProducts['SuperClass']))) {echo "selected=\"selected\"";} ?>>Appliance Item</option>
<option value="plumbing" <?php if (!(strcmp("plumbing", $row_WADAProducts['SuperClass']))) {echo "selected=\"selected\"";} ?>>Plumbing Item</option>
</select>
</label>
<?php
if (ValidatedField("ProductsUpdate","ProductsUpdate")) {
if ((strpos((",".ValidatedField("ProductsUpdate","ProductsUpdate").","), "," . "5" . ",") !== false || "5" == "")) {
if (!(false)) {
?>
<span class="textfieldServerError">
Item type is required.</span>
<?php //WAFV_Conditional Products_Update.php ProductsUpdate(5:)
}
}
}?> </td>
</tr>
<tr>
<th class="WADADataTableHeader">Item Class:</th>
<td class="WADADataTableCell"><label>
<select name="Class" id="Class" onchange="WA_FilterAndPopulateSubList(ProductCategoryList_WAJA,MM_findObj('Class'),MM_findObj('ProductCategoryID'),0,0,false,': ')">
<?php
do {
?>
<option value="<?php echo $row_rsClass['Class']?>"<?php if (!(strcmp($row_rsClass['Class'], $row_WADAProducts['ClassId']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rsClass['Class']?></option>
<?php
} while ($row_rsClass = mysql_fetch_assoc($rsClass));
$rows = mysql_num_rows($rsClass);
if($rows > 0) {
mysql_data_seek($rsClass, 0);
$row_rsClass = mysql_fetch_assoc($rsClass);
}
?>
</select>
</label>
<?php
if (ValidatedField("ProductsUpdate","ProductsUpdate")) {
if ((strpos((",".ValidatedField("ProductsUpdate","ProductsUpdate").","), "," . "12" . ",") !== false || "12" == "")) {
if (!(false)) {
?>
<span class="textfieldServerError">Item class is required.</span>
<?php //WAFV_Conditional Products_Update.php ProductsUpdate(12:)
}
}
}?></td>
</tr>
<tr>
<th class="WADADataTableHeader">Item Group:</th>
<td class="WADADataTableCell"><label>
<select name="ProductCategoryID" id="ProductCategoryID">
<?php
do {
?><option value="<?php echo $row_ProductCategoryList['CategoryID']?>"<?php if (!(strcmp($row_ProductCategoryList['CategoryID'], $row_WADAProducts['ProductCategoryID']))) {echo "selected=\"selected\"";} ?>><?php echo $row_ProductCategoryList['CategoryName']?></option>
<?php
} while ($row_ProductCategoryList = mysql_fetch_assoc($ProductCategoryList));
$rows = mysql_num_rows($ProductCategoryList);
if($rows > 0) {
mysql_data_seek($ProductCategoryList, 0);
$row_ProductCategoryList = mysql_fetch_assoc($ProductCategoryList);
}
?>
</select>
</label>
<input type="submit" name="defineCategories" id="defineCategories" value="Define..." />
<?php
if (ValidatedField("ProductsUpdate","ProductsUpdate")) {
if ((strpos((",".ValidatedField("ProductsUpdate","ProductsUpdate").","), "," . "1" . ",") !== false || "1" == "")) {
if (!(false)) {
?><span class="textfieldServerError" id="ProductCategoryIDServerValidation">
Please select a category.
</span>
<?php //WAFV_Conditional Products_Update.php ProductsUpdate(1:)
}
}
}
?>
<?php echo $row_WADAProducts['ProductCategoryID']; ?></td>


The class ID is the parent list and the ProductCategoryID is the child list.

Thanks for your help.

Sign in to reply to this post

Ray BorduinWebAssist

What does and doesn't work in this example? You need to provide a better description of where exactly you are running into problems before I could possibly know where to look.

Sign in to reply to this post
Did this help? Tips are appreciated...

jendanko336232Beta Tester

Sorry about that.

The dynamic dropdown function works when I select a class. The only part that is not working is the body onload function to start with the product category in the recordset selected. When the page loads there is no category selected.

Thanks for responding so quickly. I really appreciate it.

Sign in to reply to this post

Ray BorduinWebAssist

OK if I understand you it is populating the parent select list, but not the child... correct?

Try updating:

<body onload="WA_setSelectionsInChildList(MM_findObj('Pr oductCategoryID'),<?php echo $row_WADAProducts['ProductCategoryID']; ?>)">

and make it:

<body onload="WA_setSelectionsInChildList(MM_findObj('Pr oductCategoryID'),'<?php echo $row_WADAProducts['ProductCategoryID']; ?>')">

Sign in to reply to this post
Did this help? Tips are appreciated...

jendanko336232Beta Tester

No - that did not fix the problem. It still does not load the selected item in the child list.

Sign in to reply to this post

Ray BorduinWebAssist

sorry I missed it before... you need to add filter and populate list onload before you can set the value.... so add:

WA_FilterAndPopulateSubList(ProductCateg oryList_WAJA,MM_findObj('Class'),MM_findObj('Produ ctCategoryID'),0,0,false,': ')

Sign in to reply to this post
Did this help? Tips are appreciated...

jendanko336232Beta Tester

Thank you!! That was it! Works like a charm. I appreciate the help and most importantly the quick response as usual.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...