You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Mark Lundquist <ml...@wrinkledog.com> on 2004/08/04 19:04:32 UTC

[CForms]

Dear Coonsters...

I added this to my forms-field-styling.xsl in the template for 
<fi:form-template>:

	      <xsl:if test="descendant::node()/fi:upload">
         		<xsl:attribute 
name="enctype">multipart/form-data</xsl:attribute>
       	      </xsl:if>

Good idea, or bad?  It seems like if CForms can add this attribute 
automagically, there's no reason for me to have to remember to do it 
with my bare hands in the form template.

If I submit a patch, I'll update the userdoc as well, so I don't want 
to go to the trouble if somebody knows a reason why the patch wouldn't 
be acceptable, so let me know...

Thanks,
Mark


Re: [CForms]

Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Aug 5, 2004, at 12:16 AM, Bruno Dumon wrote:

> On Wed, 2004-08-04 at 19:04, Mark Lundquist wrote:
>> Dear Coonsters...
>>
>> I added this to my forms-field-styling.xsl in the template for
>> <fi:form-template>:
>>
>> 	      <xsl:if test="descendant::node()/fi:upload">
>>          		<xsl:attribute
>> name="enctype">multipart/form-data</xsl:attribute>
>>        	      </xsl:if>
>>
>> Good idea, or bad?
>
> I'm not very fond of it, since this needs to scan the whole tree below
> the form-template, which might be large (if it contains lots of widgets
> or large selection lists), combined with the fact that most forms don't
> use uploads anyway.

Good point.
~ml


Re: [CForms]

Posted by Joerg Heinicke <jo...@gmx.de>.
On 05.08.2004 10:53, Sylvain Wallez wrote:

>> I'm not very fond of it, since this needs to scan the whole tree below
>> the form-template, which might be large (if it contains lots of widgets
>> or large selection lists), combined with the fact that most forms don't
>> use uploads anyway. Just IMHO of course.
> 
> Same thoughts here.
> 
> A possible solution could be to handle this in the form model. Whenever 
> an upload widget is added to a form, it informs the form that it 
> contains upload widgets. The form can then report this in the produced 
> wi:form-template so that the proper enctype is used.

Sounds like a very good alternative.

Joerg

Re: [CForms]

Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Aug 5, 2004, at 1:53 AM, Sylvain Wallez wrote:
> Bruno Dumon wrote:
>> On Wed, 2004-08-04 at 19:04, Mark Lundquist wrote:
>>> Good idea, or bad?
>> I'm not very fond of it, since this needs to scan the whole tree below
>> the form-template, which might be large (if it contains lots of 
>> widgets
>> or large selection lists), combined with the fact that most forms 
>> don't
>> use uploads anyway. Just IMHO of course.
> Same thoughts here.
>
> A possible solution could be to handle this in the form model. 
> Whenever an upload widget is added to a form, it informs the form that 
> it contains upload widgets. The form can then report this in the 
> produced wi:form-template so that the proper enctype is used.

I like it.
~ml


Re: [CForms]

Posted by Sylvain Wallez <sy...@apache.org>.
Bruno Dumon wrote:

>On Wed, 2004-08-04 at 19:04, Mark Lundquist wrote:
>  
>
>>Dear Coonsters...
>>
>>I added this to my forms-field-styling.xsl in the template for 
>><fi:form-template>:
>>
>>	      <xsl:if test="descendant::node()/fi:upload">
>>         		<xsl:attribute 
>>name="enctype">multipart/form-data</xsl:attribute>
>>       	      </xsl:if>
>>
>>Good idea, or bad?
>>    
>>
>
>I'm not very fond of it, since this needs to scan the whole tree below
>the form-template, which might be large (if it contains lots of widgets
>or large selection lists), combined with the fact that most forms don't
>use uploads anyway. Just IMHO of course.
>  
>

Same thoughts here.

A possible solution could be to handle this in the form model. Whenever 
an upload widget is added to a form, it informs the form that it 
contains upload widgets. The form can then report this in the produced 
wi:form-template so that the proper enctype is used.

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }


Re: [CForms]

Posted by Bruno Dumon <br...@outerthought.org>.
On Wed, 2004-08-04 at 19:04, Mark Lundquist wrote:
> Dear Coonsters...
> 
> I added this to my forms-field-styling.xsl in the template for 
> <fi:form-template>:
> 
> 	      <xsl:if test="descendant::node()/fi:upload">
>          		<xsl:attribute 
> name="enctype">multipart/form-data</xsl:attribute>
>        	      </xsl:if>
> 
> Good idea, or bad?

I'm not very fond of it, since this needs to scan the whole tree below
the form-template, which might be large (if it contains lots of widgets
or large selection lists), combined with the fact that most forms don't
use uploads anyway. Just IMHO of course.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


Re: [CForms]

Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Aug 4, 2004, at 12:54 PM, Joerg Heinicke wrote:

> On 04.08.2004 19:04, Mark Lundquist wrote:
>
>> I added this to my forms-field-styling.xsl in the template for 
>> <fi:form-template>:
>>           <xsl:if test="descendant::node()/fi:upload">
>>                 <xsl:attribute 
>> name="enctype">multipart/form-data</xsl:attribute>
>>                 </xsl:if>
>> Good idea, or bad?  It seems like if CForms can add this attribute 
>> automagically, there's no reason for me to have to remember to do it 
>> with my bare hands in the form template.
>> If I submit a patch, I'll update the userdoc as well, so I don't want 
>> to go to the trouble if somebody knows a reason why the patch 
>> wouldn't be acceptable, so let me know...
>
> Good idea, I do it at the moment in the form template. Forgetting the 
> @enctype led also to confusion for users:
> http://marc.theaimsgroup.com/?t=109146009400005&r=1&w=4
> http://marc.theaimsgroup.com/?t=109160321900001&r=1&w=4

Embarrassingly enough, I spend too much time this morning trying to 
figure why my upload widget value was coming back null.  Then all of a 
sudden I realized I had forgotten to add enctype to this form (it 
originally didn't contain an upload control, I added it).  Sheeesh 
<slaps forehead>...

>
> I only would change the test to "descendant::fi:upload".

yes, good...

> I can not apply it as my system has not migrated to SVN yet.

OK, no hurry, or maybe someone else can... anyhow, I'll prepare the 
patch and BZ it.

~ml


Re: [CForms]

Posted by Joerg Heinicke <jo...@gmx.de>.
On 04.08.2004 19:04, Mark Lundquist wrote:

> I added this to my forms-field-styling.xsl in the template for 
> <fi:form-template>:
> 
>           <xsl:if test="descendant::node()/fi:upload">
>                 <xsl:attribute 
> name="enctype">multipart/form-data</xsl:attribute>
>                 </xsl:if>
> 
> Good idea, or bad?  It seems like if CForms can add this attribute 
> automagically, there's no reason for me to have to remember to do it 
> with my bare hands in the form template.
> 
> If I submit a patch, I'll update the userdoc as well, so I don't want to 
> go to the trouble if somebody knows a reason why the patch wouldn't be 
> acceptable, so let me know...

Good idea, I do it at the moment in the form template. Forgetting the 
@enctype led also to confusion for users:
http://marc.theaimsgroup.com/?t=109146009400005&r=1&w=4
http://marc.theaimsgroup.com/?t=109160321900001&r=1&w=4

I only would change the test to "descendant::fi:upload".
I can not apply it as my system has not migrated to SVN yet.

Joerg