On Wed, Jul 10, 2013 at 10:36 AM, <pierrick.bena(a)intech.lu> wrote:
Hi Marius, thanks for your answer.
I'm using the version 5.0.1.
I added the hidden input but I think it's at the wrong place. Where
should I add it ? in myclassClass, myclassTemplate or in the page
containing my object ?
That hidden input must be put in the sheet that controls what is
displayed in Inline Form edit mode for objects of your class. Most
classes have a template (storing default values) and a sheet
(controlling the presentation). See
http://platform.xwiki.org/xwiki/bin/view/DevGuide/FAQTutorial and
http://extensions.xwiki.org/xwiki/bin/view/Extension/Sheet+Module . A
minimal sheet that displays your 'price' property looks like this:
----------8<----------
{{velocity}}
#set ($xclass = $xwiki.getDocument('Space.SomeClass').xWikiClass)
(% class="xform" %)(((
; $doc.displayPrettyName('price')##
#set ($validationMessageKey =
$xclass.get('price').getProperty('validationMessage').value)
(% class="xErrorMsg" %)#if
($xcontext.validationStatus.errors.contains($validationMessageKey))$services.localization.render($validationMessageKey)#end(%%)
: $doc.display('price')
)))
{{html}}
<div class="hidden">
## Enable validation.
<input type="hidden" name="xvalidate" value="1" />
</div>
{{/html}}
{{/velocity}}
---------->8----------
This is partially explained in
http://platform.xwiki.org/xwiki/bin/view/DevGuide/Creating+a+form+with+vali…
(but with deprecated API and syntax).
Hope this helps,
Marius
When I put a bad value for the price, the page is not
saved.
Pierrick
On Tue, 9 Jul 2013 18:17:28 +0300, Marius Dumitru Florea
<mariusdumitru.florea(a)xwiki.com> wrote:
On Tue, Jul 9, 2013 at 4:35 PM,
<pierrick.bena(a)intech.lu> wrote:
Hi everybody !
I have a problem with validation using regular expression.
I created a class with a number property "price". I defined the Validation
Regular Expression : [-+]?[0-9]*[.,]?[0-9]+ and the Validation Message is
stored in a translation page.
I would like that the Validation message appears when I try to edit the
price property of an object of this class with a bad value. Currently it
seems my regexp is not used : I never see my validation message.
I tried to use this page but no success :
http://platform.xwiki.org/xwiki/bin/view/DevGuide/Creating+a+form+with+vali…
You mean
http://platform.xwiki.org/xwiki/bin/view/DevGuide/Creating+a+form+with+vali…
? So you added the xvalidate hidden input to your form? Can you check
that you have it on the client (inspect with Firebug or other browser
dev tool)? What happens on save when the price value is invalid? Is
the page saved with the bad value? What version of XWiki are you
using?
Hope this helps,
Marius
Need help please.
Thanks a lot!
Pierrick
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users