diff options
author | Andreas Unterkircher <unki@netshadow.at> | 2008-05-24 12:46:37 +0200 |
---|---|---|
committer | Andreas Unterkircher <unki@netshadow.at> | 2008-05-24 12:46:37 +0200 |
commit | 99dd0b5d5e19d565088595a9fd9d164bcd4834ae (patch) | |
tree | 31f781bf71e0fc431328d163c4361f07e2f9ffb2 | |
parent | f36faab3aed613fc0e1e10a34a88bf1065c80f79 (diff) |
issue121, add some js-checks if objects are there
Signed-off-by: Andreas Unterkircher <unki@netshadow.at>
-rw-r--r-- | phpfspot.js | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/phpfspot.js b/phpfspot.js index be62cfb..8db1f65 100644 --- a/phpfspot.js +++ b/phpfspot.js @@ -277,17 +277,21 @@ function startSearch() var objTemp = new Object(); objTemp['action'] = 'search'; - if(document.getElementsByName('searchfor_tag')[0].value != "") { + if(document.getElementsByName('searchfor_tag')[0] != undefined && + document.getElementsByName('searchfor_tag')[0].value != "") { objTemp['for_tag'] = document.getElementsByName('searchfor_tag')[0].value; } - if(document.getElementsByName('searchfor_name')[0].value != "") { + if(document.getElementsByName('searchfor_name')[0] != undefined && + document.getElementsByName('searchfor_name')[0].value != "") { objTemp['for_name'] = document.getElementsByName('searchfor_name')[0].value; } - if(document.getElementsByName('consider_date')[0].checked == true) { + if(document.getElementsByName('consider_date')[0] != undefined && + document.getElementsByName('consider_date')[0].checked == true) { objTemp['from'] = from; objTemp['to'] = to; } - if(document.getElementsByName('consider_rate')[0].checked == true) { + if(document.getElementsByName('consider_rate')[0] != undefined && + document.getElementsByName('consider_rate')[0].checked == true) { objTemp['rate_from'] = rate_search['from']; objTemp['rate_to'] = rate_search['to']; } @@ -346,16 +350,19 @@ function setViewMode(mode) */ function clearSearch() { - document.getElementsByName('searchfor_tag')[0].value = ''; - document.getElementsByName('searchfor_name')[0].value = ''; + if(document.getElementsByName('searchfor_tag')[0] != undefined) + document.getElementsByName('searchfor_tag')[0].value = ''; + if(document.getElementsByName('searchfor_name')[0] != undefined) + document.getElementsByName('searchfor_name')[0].value = ''; - if(document.getElementsByName('consider_date')[0].checked == true) { + if(document.getElementsByName('consider_date')[0] != undefined && + document.getElementsByName('consider_date')[0].checked == true) { document.getElementsByName('consider_date')[0].checked = false; datesearch(); } - if(document.getElementsByName('consider_rate')[0].checked == true) { + if(document.getElementsByName('consider_rate')[0] != undefined && + document.getElementsByName('consider_rate')[0].checked == true) { document.getElementsByName('consider_rate')[0].checked = false; - datesearch(); } } // clearSearch() |