CSValidation: A TextField with client-side validation with regexps and JS

Thank you! It works. For those who will find this thread - I have manually copied maven declarations from a page of plugin to pom.xml of widgetset then vaadin:update-widgetset and vaadin:compile

Upgrading to version 0.5.2 throws the follwoing exception:
java.lang.UnsupportedClassVersionError: org/vaadin/csvalidation/CSValidator : Unsupported major.minor version 52.0

I’m running with JavaSE 1.7.0_51

Ouch, it looks like my new build script didn’t set source level to JDK 1.7 like it should (or actually I should try to compile with 1.6). Sorry about that, I’ll try to make a new build tomorrow.


There’s now
version 0.5.3 available, which should fix the Java version problem.

I think there is another problem. This time with the Widgetset compilation. When I upgrade to 0.5.3 and compile my widgetset it adds the following line to my widgetset.gwt.xml file:

<inherits name="${widgetset}" />

With 0.5.1 it adds a proper inherits:

<inherits name="org.vaadin.csvalidation.widgetset.CSValidationWidgetset" />

Hi Marko. Do you think you’re going to issue an update that fixes the widgetset issue or should we stick with 0.5.1? Thanks.

Yes, I’ll make a new build soon, hopefully today.

It looks like an error in the new build script, it writes an invalid add-on manifest. Instead of putting the widget set name there it puts the variable which was undefined… So when your application widget set is regenerated, it puts the invalid line there. I tested the add-on with a manually edited widget set, so I didn’t have the problem.

If you edit an application widget set (.gwt.xml) manually, you can use the following comment in the file to prevent automatic regeneration:

<!-- WS Compiler: manually edited -->

There’s now version 0.5.4 with the widget set problem fixed. I hope there’s no more regressions… I probably should separate the demo from the add-on project to have a bit better integration testing for that, would have avoided the issues with the recent releases…

Well this addon is just refusing to play nice…

The compile now works fine but during runtime I get this exception:

java.lang.NoClassDefFoundError: org/vaadin/csvalidation/widgetset/client/csvalidator/CSValidatorState
    at com....MaskedValueField.<init>(MaskedValueField.java:63)
    at com....createEntryField(FieldFactory.java:445)

The failure happens when constructing the validator. Here’s my code;

        CSValidator intValidator = new CSValidator();   <-- throws exception
        intValidator.extend(this);
        intValidator.setRegExp("^[0-9]
{0,5}$");
        intValidator.setPreventInvalidTyping(true)

I cleaned and rebuilt the project many times. Explicitly rebuilt the Vaadin theme and WidgetSet as well, but still get this error.

Going back to 0.5.1 again :frowning:

Indeed looking at the csvalidation-0.5.4.jar I see that the org.vaadin.csvalidation.widgetset.client package includes only empty sub packages. So it appears there is still a problem with the build script.

Ah, the compiled files required by the server-side application are not included in the JAR… Only the sources are there, but not the .class files. Right. I’ll make yet another release. I now migrated to Maven and the test/demo app is a separate module, as is it’s recommended to be, so there should be less trouble like this. I hope.

Hi Marko, is there any chance you can put a working jar for 0.5.4 on the Maven repository? I want to move 0.5.4 but the jar pulled by Maven is still missing the .class files. Thanks.

Sorry, it’s taking a bit long to fix the issue, because I noticed that there is a regression with partially valid matches. I hope I soon have time to fix it. If you are not using partial matches, you could build the add-on yourself.

The project is now converted to Maven, so building it is fairly easy with:

$ git clone https://github.com/Magi42/csvalidation $ cd csvalidation/csvalidation-addon $ mvn install Oh, the configuration doesn’t currently use a SNAPSHOT version number, but has a release number. I’ll fix that.

Hi,

Thanks a lot for the add-on, I’m using it with Vaadin 7.2 and it works very well!!
I just have one little issue, I tried to use the setValidateInitialEmpty method but it seems that it does not work.

In fact I cannot see in the CSValidator connector where this field is used. Am I missing something?

Thanks a lot!

Thomas

Hello,

Excellent add-on !! But I still have the error
Caused by: java.lang.NoClassDefFoundError: org/vaadin/csvalidation/widgetset/client/csvalidator/CSValidatorState
(.class still missing in the jar). Is there a chance to have a 0.5.5 version with the .class please ? I cannot clone with git in my production environnement. I use vaadin 7.5.0.

Thank you.
Benoît.

Have this same exception on runtime, overcome this by creating CSValidatorState class in my own project, and copy content from plugin source.

Could you help me, how to install plugin with Intellij gradle project?

So far I add this line to application properties "
server.context_parameters.widgetset=com.vaadin.csvalidation.widgetset.CSValidationWidgetset
" (Spring boot based project).

On client startup I can see the error message “Failed to load the widgetset: ./VAADIN/widgetsets/com.vaadin.csvalidation.widgetset.CSValidationWidgetset4/com.vaadin.csvalidation.widgetset.CSValidationWidgetset4.nocache.js?1447333305981” . So I suppose that I need to provide some files in the requested path, but what exactly I need to provide ?

Sorry for the delay, I put the project in GitHub, turned it into a Maven project, added some TestBench tests, and now it seems to work again.

Nevertheless, setPreventInvalidTyping() is still broken, next I need to fix that.

Thank you for your help.

When I try to download book-example-vaadin7(demo source code) and use it.

The Eclipse always display error that it about csvalidation.

How can I solve this problem ?

Thank yo so much.

22574.jpg
22575.jpg
22576.jpg

Is there a way to manually force a validation? Right now it only trigger by keystroke. I would like to have another way to make the regex validate on focus or blur without any keystroke.

thank you.

That kind of validation can be done on the server-side with regular field validators, which are normally executed on blur. They are described in the
section on field validation
.