Email conversation
From | Şamil |
To | Me |
Subject | how to change text in file field |
Date | 1 February 2006 22:04 |
hi. I really admired your work. I have problem.
I need to change text in file fileld. I have found similar problem from
internet but i have to have credit card to view solution if you know can you
help?
what i found is:
I am replacing the default "Browse..." button for input type=file. This
works fine except that the form will only submit after the SUBMIT button is
clicked twice.
Any ideas on why this is happening or a workaround? I'm testing on IE 5+.
Thanks!
<html>
<head></head>
<body>
<form name="test_form" method="post" action="test.jsp">
<input type=file name=browse style="display: none;">
<input type=text name=file>
<input type=button
style="font-style:veranda; font-size:12px; font-weight:bold;
text-transform:lowercase;color:white;background-color:#A2C382;
height:22px;border-style:ridge;text-align:center;"
onClick="browse.click();file.value=browse.value;"
value="Select a File...">
<br><br>
<!-- must be clicked twice for the form to submit! -->
<input type=submit
value="Submit The Form Now!"
style="font-style:veranda; font-size:12px;">
</form>
</body>
</html>
From | Me |
To | Şamil |
Subject | Re: how to change text in file field |
Date | 3 February 2006 11:08 |
Şamil,
> I need to change text in file fileld.
For security reasons, no browser will allow you to set the path of a file to
upload, because you would then be able to upload files from the user's
computer without permission.
There is no workaround, this is intentional behaviour.
Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
From | Şamil |
To | Me |
Subject | Re: how to change text in file field |
Date | 3 February 2006 11:22 |
I understand, but do you know what is the below problem?
[...] The form will only submit after the SUBMIT button is clicked twice.
From | Me |
To | Şamil |
Subject | Re: how to change text in file field |
Date | 3 February 2006 11:40 |
> I understand, but do you know what is the below problem?
Well, for a start, that is an ugly hack :D
1. It will not work in other browsers (since the click method is only
supported by IE and Opera, and Opera will not allow it on file inputs - for
security reasons), thus making it useless for real web sites.
2. You are breaking the functionality. It is impossible to type a file
address into the text field, even though in a real file input, you can. This
means that you will confuse people who try to type in the box.
3. Your UI does not fit in with other operating systems or browsers. Mac
browsers, for example, do not have a text field that looks like that at all,
only a 'Choose' button.
Now on to your problem.
If you remove the display:none you will understand. Like I said, this is a
security measure. IE realises you fooled the user into filling in a file
input (by calling the click method). So on the first submission attempt, it
blanks the file input. The second submit actually submits the form.
Again, there is no workaround, I suggest you just accept the limitations of
file inputs. They are done that way to protect the user's security.
Tarquin
From | Şamil |
To | Me |
Subject | how to get value of javascript variable from child window |
Date | 25 February 2006 11:19 |
hello again. I have an iframe in my page and it's src is xxx.html. And in
xxx.html i want to get the value of javascipt variable which i have defined
early in parent window. How can i do that. Thanks in advance.
From | Me |
To | Şamil |
Subject | Re: how to get value of javascript variable from child window |
Date | 25 February 2006 11:59 |
Şamil,
> And in xxx.html i want to get the value of javascipt variable which i
> have defined early in parent window. How can i do that.
parent.nameOfVariable
From | Şamil |
To | Me |
Subject | hi teacher |
Date | 9 January 2007 09:54 |
I always write you when i have a problem on javascript and cannot find
solution to it form internet. I hope you will help me. This is my problem.
When printing page with javascript function window.print it adds the file
path and date to the bottom of page when printing. How can i avoid that.
Waiting ur reply..
thanks in advance
From | Me |
To | Şamil |
Subject | Re: setting options when printing |
Date | 9 January 2007 14:48 |
Şamil,
Note: please try to use relevant descriptive subjects - your emails look
like spam.
> When printing page with javascript function window.print it adds the
> file path and date to the bottom of page when printing. How can i
> avoid that.
As an author you cannot. The user's print options are their own, and you
cannot modify them. The user will need to modify them themselves, and how
they do that will depend on the browser. In Opera, for example, I use File -
Print Options - Print headers and footers. In IE, you can use File - Page
Setup - Headers and Footers.
CSS 3 generated content for paged media does have some more options (some of
which I use on my own pages):
http://www.w3.org/TR/css3-gcpm/
http://www.w3.org/TR/css3-page/#page-terms
eg:
@media print {
@page {
@top-left { content: ""; }
...
@bottom-right { content: ""; }
}
}
However, this CSS module is currently in development, and is only supported
by a professional printing application (not a browser) called Prince, and I
suspect that it will be a very long time before any browsers implement it:
http://www.princexml.com/
Tarquin
From | Şamil |
To | Me |
Subject | object.innerHTML='I AM NOT SPAM PLS READ' |
Date | 25 April 2007 10:50 |
Hello. Again write u to ask for help in javascript.
My question is how can i delete complete table or div with javascript.
Not seting its style to hidden. I want to remove it completely.
Thanks in advance,