Click to See Complete Forum and Search --> : return no undefined items


Marc
02-03-2003, 10:00 AM
:confused:
Hi ,

I'm no programmer, so what if I don't want to see the undefined fields in this passing values script?
link is;http://javascript.internet.com/forms/passing-values.html
This is the returnscript on the next page.
<SCRIPT LANGUAGE="JavaScript"><!-- This script and many more are available free online at --><!-- The JavaScript Source!! http://javascript.internet.com --><!-- Begin
function getParams() {
var idx = document.URL.indexOf('?');
var params = new Array();
if (idx != -1) {
var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
for (var i=0; i<pairs.length; i++) {
nameVal = pairs[i].split('=');
params[nameVal[0]] = nameVal[1];
}
}
return params;
}
params = getParams();
// End --></script>

Marc
02-04-2003, 06:00 AM
If a visitor doesn't fill in all fields the returnpage gives a lot of 'undefined' values.
I like to know if it is possible to filter out the nonfilled(so 'undefined') items and only show the filled in ones, by using the same script.

Friendly,

Marc