CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Complex server side validation

by mrcarver » 18 Sep 2017 16:38

CG Gurus,

I have a need for server side validation of the CGEdit control. I have read everything I can find on the forum and still not figured it out.

Please advise

Regards
Monte Carver
mrcarver
 
Posts: 70
Joined: 05 Jun 2012 10:51

by Alexander Bulei » 18 Sep 2017 18:11

Hi mrcarver,

Please tell us your expected workflow for validation.

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by mrcarver » 18 Sep 2017 18:53

I have a registration screen containing the classic First Name, Last Name, UserName, Password, etc.

As a simple example the password must meet a "complex" standard, which is already a Pascal defined library and not easily translated into a JQuery custom rule. In fact I don't currently even know how to create a custom rule.

Another example is ensuring the UserName does not already exist, which of course required a DB call.

t would be ideal if these server rules could be checked at same time a simple rule like "jqvorvRequired" is checked. But at a minimum would need checked prior to submittal.

The jQuery documentation refers to a REMOTE rule option but I have not discerned how to implement such feature.

Thank you for your quick attention.
Regards
Monte Carver
mrcarver
 
Posts: 70
Joined: 05 Jun 2012 10:51

by Alexander Bulei » 20 Sep 2017 09:25

Hi mrcarver,

Well, for the complex validations, I recommend you to check the validations on submit (on register button).

If you want check/run validations on-demand, you can implement the event OnBlur (occurs on focus out).

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by mrcarver » 20 Sep 2017 19:25

Alexander,

I am trying to understand how to force a given control to given the same visual representation that it failed as is received from the browser based validation.

An example of a server side validation would be VERY helpful.

So for example something like the following which does not work:
Code: Select all
  with ePass0.JQValidateOptions do
  begin
    Enable:= True;
    Rules.Clear;
    lRule              := Rules.Add;
// HOW SHOULD THE RULE BE SET FOR A SERVER SIDE VALIDATION?
    lRule.Rule         := jqvorvRemote;
    lRule.ErrorMessage := 'Password is not complex.;


Code: Select all
procedure myPage.OnSubmit
begin
   if NOT fxIsPasswordComplex then
    begin
      ePass0.JQValidateOptions.IsValid := False;
      ePass0.JQValidateOptions.Validate;
    end;
end;


Please clarify what I am missing in my approach. Best I can tell I wish to implement the "REMOTE" feature referenced in the documentation:
https://jqueryvalidation.org/remote-method/
mrcarver
 
Posts: 70
Joined: 05 Jun 2012 10:51

by Alexander Bulei » 22 Sep 2017 09:22

Hi mrcarver,

Well, the remote validation doesn't work in this way, and we don't have support for that.
I'll analyze the possibility to implement/support that functionality in future.

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by Alexander Bulei » 26 Sep 2017 09:24

Hi mrcarver,

Just FYI, I've added the new rule (remote) in 4.0.1.74.

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal


Return to JQEdit

cron

Who is online

Users browsing this forum: No registered users and 4 guests

Contact Us.