Menu

#45 <xf:alert> does not show for xforms-invalid event

open-postponed
None
6
2012-03-04
2012-02-02
No

The alert icon does not show (display:none) for any expression of required or constraint attributes in the bind.
This used to work in pre-beta versions.

<xforms:bind id="fname_bind" nodeset="/person-name/first-name" required="true()" constraint="string-length(.) >0"/>

<xforms:input ref="/person-name/first-name">
<xforms:label>First Name:</xforms:label>
<xforms:alert>required!!!</xforms:alert>
</xforms:input>

Discussion

  • Cristian GANTA

    Cristian GANTA - 2012-02-02

    demo source code

     
  • Cristian GANTA

    Cristian GANTA - 2012-02-03
    • assigned_to: nobody --> alain-couthures
    • priority: 5 --> 6
     
  • Cristian GANTA

    Cristian GANTA - 2012-02-03

    The bug can be only reproduced in Beta 3. I tested in Beta 3 RC and it does not happen. I identified the responsible source code: xsltforms.js (lines 4130 - 4149 XFControl.prototype.changeProp)

    This:
    this[prop] = value;
    if (prop == "notvalid" && nvalue == "") {
    value = false;
    }

    makes the value=false and the .xforms-invalid class is not attached to the span any more.

     
  • Alain Couthures

    Alain Couthures - 2012-03-04
    • status: open --> pending-postponed
     
  • Alain Couthures

    Alain Couthures - 2012-03-04

    It has been deliberately chosen not to display both required icon and invalid icon for an empty field.

    As a consequence, the alert text cannot anymore be displayed without source modifications.

    This should be considered for XSLTForms 1.0 but not for XSLTForms 1.0RC.

    Are you using XSLTForms in production?

    Thanks!

    -Alain

     
  • Cristian GANTA

    Cristian GANTA - 2012-03-04

    Hi Alan,
    Thanks for reply.

    As the bind sets the field as required required="true()" and even puts a constraint on it constraint="string-length(.) >0", an empty field can not just be ignored.

    The form should not validate the empty field as long as it is on purpose marked not to be empty. This is probably the most basic form validation condition.

    Regards, Cristian

     
  • Cristian GANTA

    Cristian GANTA - 2012-03-04
    • status: pending-postponed --> open-postponed
     
  • Alain Couthures

    Alain Couthures - 2012-03-05

    Test 6.1.3.a is correct with XSLTForms latest build as the submission is not performed when the input field is empty.

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.