We help IT Professionals succeed at work.

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

freshwaterwest
on
694 Views
Last Modified: 2008-01-09
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>
Comment
Watch Question

Don't talk to me.
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
thanks jason, I'll have a look into that..

Author

Commented:
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

Author

Commented:
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?

Author

Commented:
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
Jason C. LevineDon't talk to me.
CERTIFIED EXPERT

Commented:
Sorry, why the C grade on the answer?

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.