Hi all,

i've created a SSCCE to illustrate my problem:

'I would expect to get an alert if an empty string is entered as it does not 
meet the constraint.'

It is available at

        http://phobos103.inf.uni-konstanz.de/xforms/constraint.xml

Here is the source:

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?>
<?xsltforms-options debug="yes"?>
<html xmlns="http://www.w3.org/1999/xhtml";
      xmlns:h="http://www.w3.org/1999/xhtml";
      xmlns:xf="http://www.w3.org/2002/xforms";
      xmlns:ev="http://www.w3.org/2001/xml-events";
      xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>
<head>
        <title>Constraint</title>
        <style type="text/css">
        body { font-family: sans-serif}
        label { display: inline-block; width: 16em; margin: 2em 2em; 
text-align: right }
        </style>
        <model xmlns="http://www.w3.org/2002/xforms";>
                <instance><data xmlns="">
                    <name/>
                  </data>
                </instance>
                <bind nodeset="name" constraint="string-length(.) &gt; 2"/>
        </model>

</head>
<body>
    <group xmlns="http://www.w3.org/2002/xforms";>
        <input ref="name" incremental='true'>
                <label>String with length &gt; 2:</label>
                <alert>String must have more than two characters</alert>
        </input>
    </group>
    <hr/>
    <div>
        Constraint works, but I would expected to also see an alert if 'empty' 
string has been reached:
        <pre>
        input: ''     -> no alert (why?)
        input: 'a'    -> alert (OK)
        input: 'aa'   -> alert (OK)
        input: 'aaa'  -> no alert (OK)
        input: 'aa'   -> alert (OK)
        input: 'a'    -> alert (OK)
        input: ''     -> no alert (why? constraint string-length(.) > 2 is not 
fulfilled)
        </pre>
    </div>
</body>
</html>

Thanks,
        Alex

> On Thu, Jan 17, 2013 at 3:57 AM, Alexander Holupirek <[email protected]> 
> wrote:
> Hi list,
> 
> I have a constraint problem.
> 
> I use this bind:
> 
>         <xf:bind id="bind_xxx" nodeset="instance('inst_xxx')/xxx" 
> required="true()" constraint="string-length(.) > 1"/>
> 
> It works quite well in the following cases:
> 
> * If I have an input of string-length(.) = 1, <xf:alert/> labels show up, 
> good.
> * As soon as string-length(.) is greater than one, they go away, good.
> 
> Problem:
> 
> * If I have string-length(.) = 0, no <xf:alert/> labels show up, which is 
> unexpected.
> 
> What is working as expected, is that I can not submit data (as it obviously 
> does not fulfill the constraint).
> But since no alert message is shown, I am not able to provide feedback about 
> the missing value to the user.
> 
> Do you have any clue, what is happening here?
> 
> Thanks,
>         Alex


------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support

Reply via email to