JavaScript popup message with Modal dialog do not show up

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
jlboutin
User
Posts: 17

JavaScript popup message with Modal dialog do not show up

Post by jlboutin »

If Use JavaScript popup message is check in Advanced Settings, the popup message will not show up when used with Modal dialog edit or add page.

If it's an error message it simply stay on the current page without any warning.


arbei
User
Posts: 9348

Post by arbei »

Cannot simulate with the demo project.

I set up the Order_Details table and make it Add/Edit in modal dialog.

While i submit the form without input the value for the required field, the error message popup successfully.

Can you give us more detail about your settings?

You can also use F12->Console to see if there are any JavaScript Error.


jlboutin
User
Posts: 17

Post by jlboutin »

I think it's because I use the Form_CustomValidate

If I put a message in $CustomError and return FALSE nothing show up


arbei
User
Posts: 9348

Post by arbei »

If I put a message in $CustomError and return FALSE nothing show up

You are using the Server Event Form_CustomValidate(), but not the Client Event.

Have you enabled the option "Server-side" in [PHP] -> [General Options] -> [Validation]?


jlboutin
User
Posts: 17

Post by jlboutin »

Yes both validation option are on (Server-side and Client-side)

If I turn off Use JavaScript popup message or remove the modal dialog it work fine, but not if both are turn on


mobhar
User
Posts: 11700

Post by mobhar »

arbei wrote:
You can also use F12->Console to see if there are any JavaScript Error.

As arbei said, please press [F12] to see whether any Javascript error message.


jlboutin
User
Posts: 17

Post by jlboutin »

There are no error in the Console, only navigation information

Also, if I test a form including a password field and I input an invalid value that will be rejected by Form_CustomValidate nothing show up
Now If I enter a value that is valid and I want to save it, I will receive a message the the password strength is too low.
I can enter very complex Password and it will still be rejected.
If I try to generate a strong password it will not show up, so I cannot copy it and it will also be rejected as being not strong enough.
This append if Javascript popup message is on and I use modal dialog. It's an Add Page and Confirm is selected.


mobhar
User
Posts: 11700

Post by mobhar »

What PHPMaker version are you using?


jlboutin
User
Posts: 17

Post by jlboutin »

PHPMaker V2017.0.4 on Windows 10

Licensed version


mobhar
User
Posts: 11700

Post by mobhar »

Then please post your code/customization for discussion.


jlboutin
User
Posts: 17

Post by jlboutin »

UserName Varchar Text Required
Password Varchar Password Required
User Level TinyInt SELECT Default 0
Account No Varchar Text Required
Email Varchar Text Required Validate Email

// Form Custom Validate event
function Form_CustomValidate(&$CustomError) {
// Return error message in CustomError
$rs = $this->GetFieldValues("FormValue");
$MyCount = ew_ExecuteScalar("SELECT COUNT() FROM user WHERE username = '" . $rs["username"] . "'");
if ($MyCount == 1) {
$CustomError = "UserName not available";
return FALSE;
}
$MyCount = ew_ExecuteScalar("SELECT COUNT(
) FROM user WHERE email = '" . $rs["email"] . "'");
if ($MyCount == 1) {
$CustomError = "Email already used";
return FALSE;
}
$CustomerName = ew_ExecuteScalar("SELECT CustomerName FROM cardsinfo WHERE acctnum = '" . $rs["AcctNum"] . "'");
if ($CustomerName == "") {
$CustomError = "Unknow Accout";
return FALSE;
}
return TRUE;
}


mobhar
User
Posts: 11700

Post by mobhar »

jlboutin wrote:
I input an invalid value that will be rejected by Form_CustomValidate nothing show
up

Yes, finally I can reproduce this issue, too. The Javascript popup validation message is not shown up at all if using "Form_CustomValidate" server event in Modal dialog for Add/Copy and Edit Page.

The validation message is shown up properly when "Use Javascript popup message" option is disabled from "Tools" -> "Advanced Settings".


jlboutin
User
Posts: 17

Post by jlboutin »

Please also check that a password field will have a strange behavior when this situation is happening


mobhar
User
Posts: 11700

Post by mobhar »

jlboutin wrote:
Please also check that a password field will have a strange behavior when this situation
is happening

jlboutin wrote:
Now If I enter a value that is valid and I want to save it, I will receive a message
the the password strength is too low.

Cannot reproduce the issue regarding password strength as you mentioned.

I can only reproduce the issue of javascript popup message with dialog does not show up.


Webmaster
User
Posts: 9427

Post by Webmaster »

If you are a registered user of v2017, click Tools -> Update Template and try again.


mobhar
User
Posts: 11700

Post by mobhar »

Thank you. After updating the template, now the javascript popup error message when using "Form_CustomValidate" under "Client Scripts" section, is shown up properly from Modal dialog for "Add Page".


Post Reply