You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ananya Goswami <an...@aztec.soft.net> on 2005/09/15 14:03:42 UTC

Passing values of components to javascript function

Hi all!!!
	I have a uploadmedia html page where I am uploading files .
.I have a browse button and a filename text field 
.as soon as a file is browsed and included, the filename field should be
automatically populated with the name of the file.

I tried using javascript which works fine with normal HTML :
<script language="Javascript">
		function populateName(filepath,id)
		{	
			
			if(id==1)
			document.uploadmedia.name1.value = filepath;
			if(id==2)
			document.uploadmedia.name2.value = filepath;
			if(id==3)
			document.uploadmedia.name3.value = filepath;
			if(id==4)
			document.uploadmedia.name4.value = filepath;
			if(id==5)
			document.uploadmedia.name5.value = filepath;
		}
		</script>

<td><input type="file" jwcid="file1" id=1
onBlur="Javascript:populateName(value,id)" style="background: white; color:
grey;" /></td>
	       <td><input type="text" jwcid="name1"/></td>
....................


The above part of the code worked fine with normal HTML. But it is not
showing any result with tapestry 4.
 PLEASE HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


Thanks & Regards
-----------------------------
Ananya Goswami
Software Developer

-----------------------------
mail: ananyag@aztec.soft.net
mob: 09886886320
ph: 080-57561000
extn:3720
 
 

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Passing values of components to javascript function

Posted by Ivano <i....@mclink.it>.
Hi,
are you sure that tapestry is not overwriting the components "id" 
attributes, thus breaking your javascript conditionals?
Try checking the live output html produced by tapestry.

Ivano.

Ananya Goswami wrote:

>Hi all!!!
>	I have a uploadmedia html page where I am uploading files .
>.I have a browse button and a filename text field 
>.as soon as a file is browsed and included, the filename field should be
>automatically populated with the name of the file.
>
>I tried using javascript which works fine with normal HTML :
><script language="Javascript">
>		function populateName(filepath,id)
>		{	
>			
>			if(id==1)
>			document.uploadmedia.name1.value = filepath;
>			if(id==2)
>			document.uploadmedia.name2.value = filepath;
>			if(id==3)
>			document.uploadmedia.name3.value = filepath;
>			if(id==4)
>			document.uploadmedia.name4.value = filepath;
>			if(id==5)
>			document.uploadmedia.name5.value = filepath;
>		}
>		</script>
>
><td><input type="file" jwcid="file1" id=1
>onBlur="Javascript:populateName(value,id)" style="background: white; color:
>grey;" /></td>
>	       <td><input type="text" jwcid="name1"/></td>
>....................
>
>
>The above part of the code worked fine with normal HTML. But it is not
>showing any result with tapestry 4.
> PLEASE HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>
>
>Thanks & Regards
>-----------------------------
>Ananya Goswami
>Software Developer
>
>-----------------------------
>mail: ananyag@aztec.soft.net
>mob: 09886886320
>ph: 080-57561000
>extn:3720
> 
> 
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org