RE: Using

Ernest

Actually, I found the bit that was missing.

If the following:

document.formPrincipal.PHOTO1.disabled=true;

is inserted thus:

> 	<input type='button' value='Submit2'
>
onclick='document.formPrincipal.PHOTO1.disabled=true;document.formPrincipal.
submit();'>

the submit works !

No idea as to why.

Now I have to ponder my next problem...
Unfortunately, what I actually have is multiple form elements of type "file"
with name="PHOTO1", ie

> <form name="formPrincipal" method="post" action="resultat.php"
> enctype='multipart/form-data'>
>  Fichier 1<input type="file" name="PHOTO1" style="display:none;">
>  Fichier 1<input type="file" name="PHOTO1" style="display:none;">
> 	<input type="text" name="file">
> 	<img align=middle name="Parcourir" src="../images/parcourir.gif"
> border="0"
> onClick="document.formPrincipal.PHOTO1.click();
> document.formPrincipal.file.value=document.formPrincipal.PHOTO1.value;">
> 	<input type='button' value='Submit2'
>
onclick='document.formPrincipal.PHOTO1.disabled=true;document.formPrincipal.
submit();'>
> </form>

Clearly the above will not work as is.
I cannot just change the name of one of the "file" elements to, say,
"PHOTO2" (the called code expects multiple "PHOTO1" elements, & I cannot
change that).

Hmmmmm.....

Rgds,
Tim

-----Original Message-----
From: Ernest Cline [mailto:ernestcline@mindspring.com]
Sent: 03 December 2003 16:19
To: Tim Thorpe; www-html@w3.org
Cc: vknab@voila.fr
Subject: Re: Using





> [Original Message]
> From: Tim Thorpe <timothy.thorpe@criticalpath.net>
> To: <www-html@w3.org>
> Cc: <vknab@voila.fr>
> Date: 12/3/2003 10:54:37 AM
> Subject: Re: Using
>
>
> Hello (sorry, cannot get your name from your original email)
>
> You posted the following message to the W3 mailing list:
>
>
----------------------------------------------------------------------------
> ---------------------------------------------
> From: <vknab@voila.fr>
> Date: Mon, 17 Mar 2003 18:01:28 +0100
> Message-Id: <HBWKMG$36BFDD02F01912CB3ECF6D9A56D0FAF1@voila.fr>
> To: "www-html" <www-html@w3.org>
>
> Hello,
>
> I red the input type file problems with default value .... and understand
> why there's security problem which avoid this functionality.
>
> But, I don't understand why this does not work.
> I just would use the style="display:none" of the input and a image to
> display the button. When I click on the picture, I launch input
> file.click() . So the popup for  choosing the file to upload appear, the
> user choose the file...
> But when I submit the form, I have an js error.
> There's no security problem here since the user choose the file. So i
don't
> understand why I have this error.
> That 's the difference between :
>   - First, the user clicks on the browse button
>   - Second, the click is fired with js ?
>
>
> <form name="formPrincipal" method="post" action="resultat.php"
> enctype='multipart/form-data'>
>  Fichier 1<input type="file" name="PHOTO1" style="display:none;">
> 	<input type="text" name="file">
> 	<img align=middle name="Parcourir" src="../images/parcourir.gif"
> border="0"
> onClick="document.formPrincipal.PHOTO1.click();
> document.formPrincipal.file.value=document.formPrincipal.PHOTO1.value;">
> 	<input type='button' value='Submit2'
> onclick='document.formPrincipal.submit();'>
> </form>
>
>
----------------------------------------------------------------------------
> ---------------------------------------------
>
> Did you ever get a resolution to this ?
>
> I have the same problem.

Hard to diagnose without seeing the error, but I suspect that problem
could be from how the user agent implements display: none.
It might well be thinking that since the display is set to none,
that there should be no such attribute as PHOTO1 since there is
no box in the formatting model.  Try using style="visibility:hidden"
instead of style="display:none" and see if that solves your problem.

***
From the CSS2.1 Last Call:
none
    This value causes an element to generate no boxes in the formatting
structure (i.e., the element has no effect on layout). Descendant elements
do not generate any boxes either; this behavior cannot be overridden
by setting the 'display' property on the descendants.

    Please note that a display of 'none' does not create an invisible box;
it creates no box at all. CSS includes mechanisms that enable an
element to generate boxes in the formatting structure that affect
formatting but are not visible themselves. Please consult the section
on visibility for details.

Received on Thursday, 4 December 2003 07:13:40 UTC