How to know if a file browser item is not null using javascript fucntion
510384Oct 8 2006 — edited Oct 13 2006Hi
<br><br>
I tried to use javascript for validation. I have a file browser item named P55_FILE_NAME and I would like to know if this item is null or not before submit.
<br>
I wrote this function :<br><br>
function validate_import(f_n){<br>
if (trim(document.getElementByName(f_n).src) == "")<br>
{<br>
alert ("File name is empty.");<br>
document.getElementByName(f_n).focus();<br>
}<br>
else{<br>
doSubmit('SUBMIT');<br>
}<br>
} <br><br>
When I press submit button I got an error, sounds like the src method does not exist in my input item. <br>
Then, I looked my source page an I found this :<br><br>
input type="file" name="p_t01" size="30"
<br><br>
there is know src method and the name is not P55_FILE_NAME and I don't want to use <b>p_t01</b> that will change.<br>
<br>
I need your help.<br>
Benn