I have a control on me screen of type <FILE>. I want to set some value to that object from the database. I tried the following code using html.
[HTML]<html >
<head>
<script type="text/javascript">
function fun()
{
document.getEle mentById('j').v alue="hi"
alert(document. getElementById( 'j').value);
}
</script>
</head>
<body>
<input type="file" value="hello" id="j" />
<input type="button" onclick="alert( document.getEle mentById('j').v alue);"
<input type="button" onclick="fun(); "
</body>
</html>
[/HTML]but none of the above showed proper values for alert. it was showing null.
If I'm entering some values into the file field manalyy then proper alert is coming.
If I change the file type to text, then it is setting the value in the textfield with the value in the value attribute.
So my question is how to I set the value into the <FILE> type through the code implicitly.
[HTML]<html >
<head>
<script type="text/javascript">
function fun()
{
document.getEle mentById('j').v alue="hi"
alert(document. getElementById( 'j').value);
}
</script>
</head>
<body>
<input type="file" value="hello" id="j" />
<input type="button" onclick="alert( document.getEle mentById('j').v alue);"
<input type="button" onclick="fun(); "
</body>
</html>
[/HTML]but none of the above showed proper values for alert. it was showing null.
If I'm entering some values into the file field manalyy then proper alert is coming.
If I change the file type to text, then it is setting the value in the textfield with the value in the value attribute.
So my question is how to I set the value into the <FILE> type through the code implicitly.
Comment