Hello,
I'm using a javascript function to pass the values of various form elements. The problem is that the script breaks when I'm trying to retrieve a value of an element that is not visible, because of category/subcategory dependency.
The function is:
[code="javascrip t"]
<script language="JavaS cript">
function reloadF(f)
{
var catV = document.getEle mentById('cat') ;
var subcatV = document.getEle mentById('subca t');
var priceV = document.getEle mentById('price ID'); // depends on category
var priceRentV = document.getEle mentById('price RentID'); // depends on category
location.href = 'file.php?catV= ' + catV.value + '&subcatV=' + subcatV.value + '&priceV=' + priceV.value + '&priceRentV= ' + priceRentV.valu e;
</script>
[/code]
in the form:
[code="html"]
<select id="cat" onchange="reloa dF(this.form)" ...>
<select id="subcat" onchange="reloa dF(this.form)" ...>
if ($_GET['catV'] == 3)
<input type="text" id="priceID" value="$_GET['priceV']" ...>
if ($_GET['catV'] != 3)
<input type="text" id="priceRentID " value="$_GET['priceRentV']" ...>
[/code]
Thank you.
I'm using a javascript function to pass the values of various form elements. The problem is that the script breaks when I'm trying to retrieve a value of an element that is not visible, because of category/subcategory dependency.
The function is:
[code="javascrip t"]
<script language="JavaS cript">
function reloadF(f)
{
var catV = document.getEle mentById('cat') ;
var subcatV = document.getEle mentById('subca t');
var priceV = document.getEle mentById('price ID'); // depends on category
var priceRentV = document.getEle mentById('price RentID'); // depends on category
location.href = 'file.php?catV= ' + catV.value + '&subcatV=' + subcatV.value + '&priceV=' + priceV.value + '&priceRentV= ' + priceRentV.valu e;
</script>
[/code]
in the form:
[code="html"]
<select id="cat" onchange="reloa dF(this.form)" ...>
<select id="subcat" onchange="reloa dF(this.form)" ...>
if ($_GET['catV'] == 3)
<input type="text" id="priceID" value="$_GET['priceV']" ...>
if ($_GET['catV'] != 3)
<input type="text" id="priceRentID " value="$_GET['priceRentV']" ...>
[/code]
Thank you.
Comment