[Javascript] submit form functions

Allard Schripsema allard-schripsema at procergs.rs.gov.br
Thu Oct 14 12:20:30 CDT 2004


Hi Uri,

1st suggestion: set the form method to post instead of get...

If you already have that, show us the code for the submit..... ,
Some questions: 
Are you using the getListValue(list) in the submit code???
Why is the select not inside the form you?re submitting?

A comment:
Why do a removespaces in javascript if you can treat that serverside? 
(observation: the tstring variable when you return string?) 
if you want to clean spaces why not use a regular expression : / /g

Allard


-----Original Message-----
From: javascript-bounces at LaTech.edu
[mailto:javascript-bounces at LaTech.edu]On Behalf Of Grinwald, Uri
Sent: Thursday, October 14, 2004 11:38 AM
To: [JavaScript List]
Subject: RE: [Javascript] submit form functions


Hi Guys.

I currently have a drop down list being populated by values from an
access database.
When the user selects an option two javascript functions are used on the
onChange event handler.
One that retrievs the value and the other that submits the form.

function getListValue(list){
	var listValue="";
	if (list.selectedIndex != -1) {
		listValue = list.options[list.selectedIndex].value;
		listValue = removeSpaces(listValue);
		}
	return (listValue);
}
function removeSpaces(string) {
	var tstring = "";
	string = '' + string;
	splitstring = string.split(" ");
	for(i = 0; i < splitstring.length; i++)
	tstring += splitstring[i];
	return string;
}

My problem is that the value is being passed as a URL variable which
means I am using the QueryString to obtain the value. This is being
displayed in the URL address bar so I tried changing the form to post
but that causes the functions to not work altogether. Is there a way of
maybe having the function pass the value as a hiidne field so that I can
use the Request.Form to obtain the value?

Thanks for your time.

Uri
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript





More information about the Javascript mailing list