掲示板

Web Form validation not working

10年前 に Timo Kurowski によって更新されました。

Web Form validation not working

Regular Member 投稿: 240 参加年月日: 13/06/24 最新の投稿
Hello!

I am using liferay 6.1 ga2.

I have deployed the Web Form Portlet and try to make a validation for E-Mail Adresses or validation in general.

Currently i am using this code, but i tried many others without success, too.

var isEmail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
if(currentFieldValue.search (isEmail) == -1 && currentFieldValue != '') {
return false;
} else {
return true;
}


It acts like i have no validation code at all, just submits everything. Even if i just try to validate that number 1 is typed in.

I also changed validation.sript.enabled to true in portlet.properties.

I have no errors in my logs.

I've seen many other threads, but none of those ever helped me. If there is a solution, no one posted it, it seems.

Can someone help me with this issue?
10年前 に James Harrison Schueler によって更新されました。

RE: Web Form validation not working

10年前 に Timo Kurowski によって更新されました。

RE: Web Form validation not working

Regular Member 投稿: 240 参加年月日: 13/06/24 最新の投稿
I'm sorry, i don't really get what you want to tell me...


There is a Validation setting in the portlet, but you tell me to use Alloy? Why? Is my problem a known bug or something?

I mean, if i need to hook that portlet, i might as well just write my own from scratch... I was hoping this portlet would save me from the effort, though.
10年前 に Muhammad Taha によって更新されました。

RE: Web Form validation not working

Junior Member 投稿: 63 参加年月日: 12/05/01 最新の投稿
Hi Timo Kurowski, can u try this.
var regex=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if(currentFieldValue.match(regex)){
return true;
}
else{
return false;
}
10年前 に Timo Kurowski によって更新されました。

RE: Web Form validation not working

Regular Member 投稿: 240 参加年月日: 13/06/24 最新の投稿
Hello Muhammad Taha,

i tried your code, it does not work for me. I still get the "The form information was sent successfully." message.
10年前 に Muhammad Taha によって更新されました。

RE: Web Form validation not working

Junior Member 投稿: 63 参加年月日: 12/05/01 最新の投稿
If you have already put validation.script.enabled=true in portlet.properties file at /web-form-portlet/WEB-INF/classes it should work. please remove special characters from name you given for input. and for experiment just give name as email
10年前 に Timo Kurowski によって更新されました。

RE: Web Form validation not working

Regular Member 投稿: 240 参加年月日: 13/06/24 最新の投稿
It should, but isn't working.

Like i said, validation.script.enabled=true is enabled. I can simply put "a" in the field, it won't validate.
10年前 に Muhammad Taha によって更新されました。

RE: Web Form validation not working

Junior Member 投稿: 63 参加年月日: 12/05/01 最新の投稿
hmm...change the names for input fields. u must have given names like name, email, phoneno.. also restart the server. once same thing happened for my colleague.
10年前 に Timo Kurowski によって更新されました。

RE: Web Form validation not working

Regular Member 投稿: 240 参加年月日: 13/06/24 最新の投稿
I used the standard names for the fields. It's actually just E-Mail and Name.

Restarted the Server, but still no use.. If there at least would be something in the logs, but theres nothing..
thumbnail
10年前 に Rajeev K によって更新されました。

RE: Web Form validation not working

Regular Member 投稿: 214 参加年月日: 09/06/19 最新の投稿
Timo Kurowski:
I used the standard names for the fields. It's actually just E-Mail and Name.

Restarted the Server, but still no use.. If there at least would be something in the logs, but theres nothing..



Hi Timo,

I am also facing the same issue where the Javascript validation is just not getting called.
Were you able to get this working?
10年前 に Timo Kurowski によって更新されました。

RE: Web Form validation not working

Regular Member 投稿: 240 参加年月日: 13/06/24 最新の投稿
Hi Rajeev.

Unfortunately, i didn't find a solution for this problem.