Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: posting values problem


Message #1 by "kostas lagos" <klag@i...> on Tue, 18 Feb 2003 09:40:21
	Where are these two functions, changeV and changeText ?  In the same
page or in two consecutive pages ?

	My intuition tells me that it's the second case.  If that's true,
you have to know that when a browser loads another page, everything 
from the
previous page just _disappears_.  If you want some information to 
persist
between pages, there're at least three methods (as discussed again and 
again
in the list.  Robert, I think this can also go to FAQ):
1) use GET method in form so that your infos are present as query 
string for
the second page.  Scripts in 2nd page then use location.search to 
recover
the infos.

2) use GET or POST method in form to send infos to server.  When the 
server
generates the 2nd page, it puts back the infos in source code in one 
way or
another.

3) use another frame as a storage.

HTH

> -----Message d'origine-----
> De : kostas lagos [mailto:klag@i...]
> Envoy=C3=A9 : mardi 18 f=C3=A9vrier 2003 10:40
> =C3=80 : javascript
> Objet : [javascript] posting values problem
>
>
> Hello All,
>
> I seem to have a problem with some posted values from a form.
> i have added
> an 'onClick' event in a button (name=3D"submitBtn") and i try
> to change the
> value of a hidden field before submitting the form.The code
> is like this:
>
> function changeV()	{
> var hiddenB=3Ddocument.all ? document.all['changeVal'] :
> document.getElementById('changeVal');
> hiddenB.value=3D"*";
> document.form2.submit();
> }
>
> I have also added a function on the 'onLoad' event in the
> 'body' tag in
> order to check the value of the hidden field and perform some
> actions like
> this:
>
> function changeText(elementID1,elementID2, insertedText1,
> insertedText2)
> 	{
>
> var hiddenBox=3Ddocument.all ? document.all['changeVal'] :
> document.getElementById('changeVal');
>
> 	if(hiddenBox.value=3D=3D'*')	{
> 		var element1 =3D document.all ?
> document.all[elementID1] :
> document.getElementById(elementID1);
> 		var element2 =3D document.all ?
> document.all[elementID2] :
> document.getElementById(elementID2);
> 		element1.value=3DinsertedText1;
> 		element2.value=3DinsertedText2;
> 	}
> }
>
> The problem is that the hidden field value is not changed and
> i get back
> the initial value..The changeText works..Whats the problem??
>
> Thanks in advance
>
> Kostas lagos
>

  Return to Index