0

constraint for email validation

asked 2006-03-31 12:50:25 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3661776

By: oberinspector

I have written a constrain class for an email registration input field to check wether the email is valid and not yet registered and stored in db:

public class RegisterEmail implements com.potix.zul.html.Constraint { ...

2 questions:

1. how can i set my own constrain class?
I tried this:
<textbox constraint="mypackage.RegisterEmail" id="email" /> but... i got exceptions

2. When is the validate method invoked? From some tests with intbox it looks like it is invoked, when the focus is taken away from the textbox... is this a correct assumption?

delete flag offensive retag edit

15 Replies

Sort by ยป oldest newest

answered 2006-03-31 14:30:01 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3661933

By: tomyeh

1.
<zscript>
myct = new mypackage.RegisterEmail();
</zscript>
<textbox constraint="myct"/>

2. onChange (triggered by onblur -- losing focus) and setValue

Looks like I have to provide a function (from /WEB-INF/tld/web/core.dsp.tld) such that you could do <textbox constraint="c:new('mypackage.RegisterEMail')"/>

link publish delete flag offensive edit

answered 2006-03-31 15:03:08 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3662018

By: oberinspector

thanks! in between i found it... ;)

<zscript>
ctt_email = new mypackage.RegisterEmail(); ...

<textbox constraint="${ctt_email}" id="email" /> ...

works fine for me... for each of my textboxes...

but when i click submit without solving the constraint no more error messages came up...

should i also provide a constraint for submit and make again the checks? i tried something like:

void submit() {
try{
ctt_nickname.validate(nickname, nickname.value);
ctt_email.validate(email, email.value);
}catch (Exception e){
alert(e.getMessage());
return; //
}
...

with this alert/messagebox ok events i get a nullpointer exception, when my HibernateSessionEventThreadCleanup tries to get the session...
...
if(event.getPage()
.getSession() //nullpointer exception
.getAttribute(HIBERNATE_SESSION_OWNER)==null)
return;
...
on the other hand... when i try to get the session from the component (passed in cleanup) all my input fields in my form are disabled... a little bit strange...???

link publish delete flag offensive edit

answered 2006-03-31 16:35:43 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3662426

By: tomyeh

Thomas,

Is it the same thing I discussed with Michael in http://sourceforge.net/tracker/index.php?func=detail&aid=1461209&group_id=152
762&atid=785191 ?

HibernateSessionCleanup is the same as you sent to me a couple days ago?
NullPointerException happens only if alert occurs?

Tom

link publish delete flag offensive edit

answered 2006-03-31 16:37:19 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3662429

By: tomyeh

BTW, I rewrote the chapter about database access in the developer's guide (from the latest Nightly). Would you take a look and give me some feedback? Thanks.

link publish delete flag offensive edit

answered 2006-03-31 17:05:50 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3662473

By: oberinspector

Hello Tom,

i try to reproduce the error with the debugger...
The mentioned link does'nt work... could you please check it!?

My bootstrap hibernate support works fine... i did some things to my EventThreadCleanup, but i'm not yet satisfied with my hibernate session cleanup handling... i'm working on it... ;) i can send you a link to the java files in my subversion repository...

BTW... i tried to bring the ZK 1.1 sources in eclipse to step through your code, but i get build errors... seems the both imports:
import com.potix.zk.mesg.MZk;
import com.potix.mesg.MCommon;
can not be resolved... it was the same with 1.0

i will have a look to your developers guide...

link publish delete flag offensive edit

answered 2006-04-01 02:57:33 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3663226

By: michaelkmb

Tom,

I found the link you provided on the forum always have an extra ";" before aid= ( may be you should check you browser :) ).

The correct link should be
http://sourceforge.net/tracker/index.php?func=detail&aid=1461209&group_id=152762
&atid=785191

Regards,
Michael

link publish delete flag offensive edit

answered 2006-04-01 03:01:03 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3663229

By: michaelkmb

Tom,

I found it is not your problem, it the the problem with SourceForge.net "Submit".
(The ";" is not enter by me).

So the link provided above is also incorrect, should have the ";" after "&"
deleted.

Michael

link publish delete flag offensive edit

answered 2006-04-03 02:23:20 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3665077

By: tomyeh

MZk, Mommon... are dynamically generated by our build tools. They are simply a map of message IDs.

link publish delete flag offensive edit

answered 2006-04-03 02:35:02 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3665090

By: tomyeh

My browser (FF) didn't show up the semicolon. Strang!

link publish delete flag offensive edit

answered 2006-04-23 09:39:54 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3699235

By: nobody

hi tom,

this link does not work. i am interested to read your discussion.

http://sourceforge.net/tracker/index.php?func=detail&;aid=1461209&group_id=15276
2&atid=785191

link publish delete flag offensive edit
Your reply
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

RSS

Stats

Asked: 2006-03-31 12:50:25 +0800

Seen: 809 times

Last updated: Jan 13

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