Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-14552

Class field validation does not work when enabling form validation

    Details

    • Difficulty:
      Unknown
    • Similar issues:

      Description

      Steps to reproduce:
      1. Create a class 'MySpace.MyClass' with a property of type String called 'phone'
      2. Set its validation regular expression to /^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/ (that would match 000-000-0000)
      3. Add a validation message for this field
      4. Create a sheet and bind it to this class, containig :

      {{velocity}}
      #set($myObj = $doc.getObject('MySpace.MyClass'))
      ; Phone
      : $doc.display('phone', $myObj)
      
      #if($xcontext.action == 'edit')
        {{html}}
          <input type="hidden" name="xvalidate" value="1" />
        {{/html}}
      #end
      {{/velocity}}
      

      5. Create a template document 'MySpace.MyTemplate' and add an object of type 'MySpace.MyClass'
      6. Create a new document going to : http://localhost:8080/xwiki/bin/edit/MyOtherSpace/TestPage?editor=inline&template=MySpace.MyTemplate
      7. Fill in the 'Phone' input with 'a' (a value that would not pass the validation)
      8. Click on 'Save & View' button
      9. You will notice that the form fields are readonly and a notification saying 'Saving ...0%' is displayed at the bottom of the page, then nothing else happens (see the screenshot)

      Expected result : the user would be redirected to the preview action, allowing her to modify the field value and the validation error message could be nicely displayed in the form.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                ralucamorosan Raluca Stavro
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Date of First Response: