0

I got a problem with primefaces 5.1.

I want to check a field variable for maximum length. This code snipped is working:

        <p:outputPanel id="insertField" columns="3" style="display: none;">
            <ui:param name="insertTable" value="#{tabDefineRelationTable.insertValues}" />
            <p:dataTable value="#{insertTable.values}"  var="insertValue" editable="true" id="insertTableDynamic">
                <p:columns value="#{insertTable.headlines}"  var="insHead">
                    <f:facet name="header">
                       #{insHead.headline.a_name}
                    </f:facet>
                    <ui:param name="insAttribute" value="#{insertValue.getAttribute(insHead.headline.a_name)}"></ui:param>
                    <p:inputText value="#{insAttribute.valueAsString}">
                        <f:validateLength maximum="4" />
                        <f:validateRegex pattern=".*"/>
                    </p:inputText>
                </p:columns>
            </p:dataTable>
            <p:commandButton value="Insert" action="#{tabDefineRelationTable.insert}" id="btnInsert" update=":tabView:relationTableForm:valueTable :tabView:relationTableForm:insertField"/>
            <p:commandButton value="Cancel" type="button" onclick="$(document.getElementById('tabView:relationTableForm:insertField')).hide()"/>
        </p:outputPanel>

but if I want to test this value for a variable length, like:

                    <f:validateLength maximum="#{insAttribute.objectSpecification.attributeType.dlength}" />

it's not working fine. I think that the variable is not exhausted and so the value was null or something else. Got anyone at this point a good solution for that?

I don't want to use Omnifaces, because it's not accepted by my customer.

Best regrads Björn

Björn
  • 57
  • 1
  • 12
  • It works fine for me and anyone else when copypasted straight into a `` (you should always always write your question in such way and also test it yourself that way to prepare for that, see also http://stackoverflow.com/tags/jsf/info). So, the cause of the problem is not visible in the information provided so far. Perhaps this snippet is actually being placed inside an iterating component such as a data table and the `insAttribute` actually represents the currently iterated object? This way the problem is then indeed explainable. – BalusC Jul 02 '15 at 09:57
  • Hello BalusC, yes you are right. Sorry... I putted this field into a data table. could you explain me, how to solve such a problem? Thanks a lot for your fast reply. Best regards Björn – Björn Jul 02 '15 at 10:14
  • This has been asked and answered before :) – BalusC Jul 02 '15 at 10:18
  • please release this question again. I need a workarround without using omnifaces, sorry. – Björn Jul 02 '15 at 12:13
  • The answer mentions multiple solutions. Just pick the solution without OmniFaces. – BalusC Jul 02 '15 at 12:29
  • Heyho BalusC, I take a look of your answer. But now I changed my code to a closer example, what I need. I think that didn't answer your posting. Best regards Björn – Björn Jul 03 '15 at 13:21
  • I now realize I pasted the wrong duplicate link. Here's the right one: http://stackoverflow.com/questions/9194871/setting-a-validator-attribute-using-el-based-on-uirepeat-var Nonetheless, the current duplicate also links to http://stackoverflow.com/questions/7530560/how-to-set-converter-properties-for-each-row-of-a-datatable/ which has the same grounds and solutions. You'd have noticed it if you read the text and followed the links. – BalusC Jul 03 '15 at 13:27

0 Answers0