Link to home
Start Free TrialLog in
Avatar of freshwaterwest
freshwaterwestFlag for United Kingdom of Great Britain and Northern Ireland

asked on

spry form select dependent drop-downs - on submit last one is undefined (price) in url (get method)

Created my first spry xml dependent drop down select menus, for:
brand
model
price

When submitted the url contains first 2 values, but last one is undefined:

http://www.qmarketing.co.uk/dd/index1.php?brand_id=1&model=Cosmograph+Daytona&price=undefined&submit=Go

page follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wdg="http://ns.adobe.com/addt">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>David Duggan Watches - London Rolex, Patek Philippe, Cartier and Fine Watch Dealer</title>
<link href="ddmain.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jumpmenu.js"></script>
<script type="text/javascript" src="script/swfobject.js"></script>
<script src="SpryAssets/xpath.js" type="text/javascript"></script>
<script src="SpryAssets/SpryData.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationSelect.js" type="text/javascript"></script>
<script type="text/javascript">
var dsBrands = new Spry.Data.XMLDataSet("brandsxml.php", "watches/brands",{sortOnLoad:"url",sortOrderOnLoad:"ascending",distinctOnLoad:true});
var dsModels = new Spry.Data.XMLDataSet("{dsBrands::url}", "watchmodels/models/model");
var dsPrices = new Spry.Data.XMLDataSet("pricerange.php?model={dsModels::model}", "watchmodels/models/price_range",{distinctOnLoad:true});
</script>
<link href="SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css" />
<?php
$Img1 = "dd-intro00.swf";

$Img2 = "dd-intro00b.swf";

$Img3 = "dd-intro00c.swf";

$Img4 = "dd-intro00d.swf";

$Img5 = "dd-intro00.swf";

$num = rand (1,5);
$Image = ${'Img'.$num};
?>
</head>

<body><div id="container">
<div id="topnav" class="top"><?php include("topnav.shtm") ?>
</div>
<div id="flash1"><img src="images/dd-intro00.jpg" alt="Burlington Arcade 020 7491 1675" width="773" height="288" /></div>
<script type="text/javascript">
            // <![CDATA[
            
            var so = new SWFObject("images/<?php echo $Image ?><?php if($_GET['brand_id'] != NULL){ ?>?skip=1<?php } ?>", "david duggan watches", "773", "288", "8", "#748DB5");
            so.addParam("wmode", "transparent");
            so.addVariable(""); // this line is optional, but this example uses the variable and displays this text inside the flash movie
            so.write("flash1");
            
            // ]]>
</script>
<div id="watchnav" class="short"><?php include("navigation.shtm") ?>
<br clear="all" />
</div>
<div id="textarea">
<div class="searchbox"><div class="searchinner">
<a href="watches.php">Click here to view all our watches</a>

<form name="selectForm" method="get" action="">
      <label class="labels"><span class="left">Brands:</span>
      <span spry:region="dsBrands" id="brandSelector">
            <select spry:repeatchildren="dsBrands" name="brand_id" onchange="document.forms[0].model.disabled = true; dsBrands.setCurrentRowNumber(this.selectedIndex);">
                  <option spry:if="{ds_RowNumber} == {ds_CurrentRowNumber}" value="{url}" selected="selected">{brand_name}</option>
                  <option spry:if="{ds_RowNumber} != {ds_CurrentRowNumber}" value="{url}">{brand_name}</option>
            </select>
      </span></label>
      <label class="labels"><span class="left">Models:</span>
      <span spry:region="dsModels" id="modelSelector">
            <select spry:repeatchildren="dsModels" id="model" name="model" onchange="document.forms[0].price.disabled = true; dsModels.setCurrentRowNumber(this.selectedIndex);">
                  <option spry:if="{ds_RowNumber} == {ds_CurrentRowNumber}" value="{model}" selected="selected">{model}</option>
                  <option spry:if="{ds_RowNumber} != {ds_CurrentRowNumber}" value="{model}">{model}</option>
            </select>
      </span></label>
      <label class="labels"><span class="left">Prices:</span>
      <span spry:region="dsPrices" id="priceSelector">
            <select spry:repeatchildren="dsPrices" id="price" name="price">
                  <option spry:if="{ds_RowNumber} == {ds_CurrentRowNumber}" value="{price_value}" selected="selected">&pound;{price_range}</option>
                  <option spry:if="{ds_RowNumber} != {ds_CurrentRowNumber}" value="{price_value}">&pound;{price_range}</option>
</select>
      </span></label>
      <input name="submit" type="submit" id="submit" value="Go" />

</form>



</div>
</div>
<div class="leftcolumn1"><h1><img src="images/forthebest.gif" alt="for the best in fine pre-owned timepieces by Rolex, Cartier, Patek Philippe and more..." longdesc="index.php" /><span class="textonly">for the best in fine pre-owned timepieces by Rolex, Cartier, Patek Philippe and more...</span></h1>
  <p>Working with some of the world&rsquo;s leading brands, our team of 6 expert staff has a combined experience of over 150 years.&nbsp; If you&rsquo;re looking for fine pre-owned time pieces, we regularly deal in <span class="lightblue">Cartier, Vacheron, Panerai, Jaeger-Le-Coultre, Lange &amp; Sohne, International Watch Company</span> and other fine names. However, we have a particular passion for pre-owned <span class="lightblue">Patek Philipe</span> and <span class="lightblue">Rolex</span> and are regularly consulted by collectors around the world. </p>
  <p><span class="quote"><span class="lightblue"><em>&ldquo;The best known and most highly respected used watch business in Britain.&rdquo; </em></span><br />
      <strong>QP, fine watch magazine, issue 15, 2005</strong></span></p>
  <p><a href="aboutus.php">more about us...</a></p>
</div>
</div>
<br clear="all" />
<?php include("base.shtm") ?>
</div>
</body>
</html>
ASKER CERTIFIED SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of freshwaterwest

ASKER

thanks jason, I'll have a look into that..
Hi Jason,

I've managed to get it working (price=5 for example)
Problem now is I can't seem to get it to distinctOnLoad any longer, tried a few variations

http://www.qmarketing.co.uk/dd/index1.php
(I've taken out the form action now so it's easier to see the url on the page)

this is the xml page where the data is coming from:
http://www.qmarketing.co.uk/dd/pricerange.php?model=Cosmograph+Daytona

thanks
Phil
sorry thought I should send this to show how I'm getting the data:

<script type="text/javascript">
var dsBrands = new Spry.Data.XMLDataSet("brandsxml.php", "watches/brands",{sortOnLoad:"url",sortOrderOnLoad:"ascending",distinctOnLoad:true});
var dsModels = new Spry.Data.XMLDataSet("{dsBrands::url}", "watchmodels/models/model");
var dsPrices = new Spry.Data.XMLDataSet("pricerange.php?model={dsModels::model}", "watchmodels/models","price_value","price_range",{distinctOnLoad:true});
</script>

think it might be a case of getting this right?
think I've managed to sort it thanks... I needed to come back up a node-level in my link and not list the fields in there at all

cheers
Sorry, why the C grade on the answer?