Bug #42474

Possible bug with short form conditions in viewhelper tags

Added by Thomas Hempel almost 3 years ago. Updated almost 3 years ago.

Status:Closed Start date:2012-10-29
Priority:Should have Due date:
Assigned To:Bastian Waidelich % Done:

0%

Category:ViewHelpers
Target version:-
Has patch:No Affected Flow version:FLOW3 1.1.0

Description

Hi,

I'm not entirely sure, if this is a bug or if do something wrong. Some more people looked at it and considered it as a bug. There fore I'm filing this here right now.

The following statement can be found in my template:

<f:form.textfield name="{foo}" property="{bar}" {f:if(condition:'{disabled}', then:'disabled="disabled"')} />

I would expect a textfield with attribute name and a value. It might also have the attribute set. But what I actually get is this:

<f:form.textfield name="firstname" property="firstname" disabled="disabled" />

(With or without the disabled="disabled")

Am I doing it wrong or is this a bug which should be investigated more?


Related issues

duplicates TYPO3.Fluid - Bug #9454: If condition in viewhelper attribute Rejected 2010-08-25

History

#1 Updated by Thomas Hempel almost 3 years ago

Just a small addition. The curly brackets are all solved correctly. But the outer textfield viewhelper is not. It is correct if I remove the condition entirely.

#2 Updated by Bastian Waidelich almost 3 years ago

Hi Thomas,

1<f:form.textfield name="{foo}" property="{bar}" {f:if(condition:'{disabled}', then:'disabled="disabled"')} />

Is no valid Fluid syntax unfortunately.

1<f:form.textfield name="{foo}" property="{bar}" disabled="{disabled}" />

should work, though

#3 Updated by Thomas Hempel almost 3 years ago

Hi Bastian,

the problem with your solution is, that browser interpret the disabled attribute no matter what it's value is. So with your code it's always disabled which is not what I want. ;-)

The following code will give you 5 disabled fields and one (the last) enabled:

<form>
<input type="text" disabled="0" value="0" />
<input type="text" disabled="1" value="1" />
<input type="text" disabled value="no value" />
<input type="text" disabled="TRUE" value="TRUE" />
<input type="text" disabled="FALSE" value="FALSE" />
<input type="text" value="not set" />
</form>

Beside that, what is wrong with the syntax? Is it really wrong syntax or ist just nested too deep?

#4 Updated by Bastian Waidelich almost 3 years ago

  • Status changed from New to Needs Feedback
  • Assigned To set to Bastian Waidelich

Thomas Hempel wrote:

Hi Thomas,

the problem with your solution is, that browser interpret the disabled
attribute no matter what it's value is.

Of course, you're right.
Then you'll probably have to go for

1<f:if condition="{disabled}">
2  <f:then>
3    <f:form.textfield name="{foo}" property="{bar}" disabled="disabled" />
4  </f:then>
5  <f:else>
6    <f:form.textfield name="{foo}" property="{bar}" />
7  </f:else>
8</f:if>

Beside that, what is wrong with the syntax? Is it really wrong
syntax or ist just nested too deep?

It's wrong, the Fluid parser doesn't detect your tag as fluid viewhelper anymore and skips it.

I'd close the issue if you agree

#5 Updated by Bastian Waidelich almost 3 years ago

  • Status changed from Needs Feedback to Closed

Closing ticket because the syntax is invalid and most probably will never be.
Feel free to re-open if you don't agree or have further comments

Also available in: Atom PDF