0

Custom Validator: sometimes works, sometimes doesn't

asked 2018-08-22 04:33:02 +0800

psinalberth gravatar image psinalberth
52 6

Hi, I'm facing a strange situation with validator. I'm trying to run a piece of code like this:

http://zkfiddle.org/sample/2fnhdnp/16-custom-form-validator

Well, sometimes it works and sometimes don't. When I inspect ctx.getProperties("parent") I see a HashMap<String, Property[]> with parent as key and three PropertyImpl objects. It turns that I check ctx.getProperties("parent")[0].getValue() to get Parent but sometimes it is on [1], [2] and I got an invalid message telling me parent is null but actually it's not. How could I fix that? Basically this is happening with complex objects and validator works fine for String, Integer...

delete flag offensive retag edit

Comments

what version are you testing? The fiddle in 8.5.2 I couldn't simulate what you are talking about.

chillworld ( 2018-08-22 13:07:57 +0800 )edit

I'm testing v.8.5.0. Like I said, it is strange, because sometimes I just refresh the page and parent appears on PropertyImpl[1] or 2. The only difference is that I'm using a bandbox instead combobox. I'm thinking about creating a method to extract what I need from Property array.

psinalberth ( 2018-08-22 17:54:52 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-08-24 19:03:40 +0800

psinalberth gravatar image psinalberth
52 6

I don't what was happening but now it's working. I've created a method to get my object, no matter if it is on [0..n]. Maybe there was something wrong with my form or some binding, because like I said, my validator was working fine for any property but Person.

link publish delete flag offensive edit

Comments

Nice to.hear you have solved it

chillworld ( 2018-08-24 23:47:58 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2018-08-22 04:33:02 +0800

Seen: 6 times

Last updated: Aug 24 '18

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More