Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Sunday, July 6, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Best way to perform field validation?
Chris Burriss
Posts: 120
 
Best way to perform field validation?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Oct 09 11:16 AM
Take System:Account Detail, for example. If I want to ensure that a CustomerID field is entered only once in SalesLogix, how is this best handled? I've tried the OnExitControl event but that doesn't seem to work right. Here's the code:

Sub txtCustomerIDExitControl(Sender)
If "" & txtCustomerID.Text <> "" Then
If "" & GetField("C_TW_CustomerID", "Account", "C_TW_CustomerID = '" & txtCustomerID.Text & "'") <> "" Then
txtCustomerID.Text = ""
frmAccountDetail.Post
MsgBox "This CustomerID already exists for another account.", vbOKOnly, "CustomerID Not Unique"
End If
End If
End Sub

This works okay if the user happens to click into another field. But if they change the CustomerID and then navigate to the next account, duplicate data can be saved. OnChange doesn't work for this either. So, how is this best handled? I appreciate your comments!
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Best way to perform field validation?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Oct 09 4:18 PM
have posted these ONExit bugs several times.....including 7.5.2 beta 3.

Try capturing Escape, Enter Keys....handling clicking repeatedly into the same control (each click fires off the on exit!) or as you've seen if they navigate away from the form sometimes SLX doesn't even catch the OnExit.....add in Formatted data (currency, phone number) and it really becomes tricky.

Here's what we do.....
1. put a dummy "Save CustomerID" button next to the ID field. Invisible
2. When they enter the CustomerID field, make the Save CustomerID Button VISIBLE.
3. When they click on the Save CustomerID button, simply make this button invisible.

Basically you've forced them to click on the form after editing the customerID field, and the OnExit will fire off. If they navigate away from the form and the CustomerID doesn't save, you ask them if they clicked on the Save button before they left their changes stranded in Never Never Land!

We've used a Green S button, a Blue diskette icon, etc. (and a Red button with a big black X on it for Delete/clear out.
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Best way to perform field validation?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Oct 09 4:54 PM
Have you tried the "OnValidate" event of the Form?

Not sure how much 7.5.2 has changed from 7.5.1, but if you look at the Account Detail form, it may already have a handler for the OnValidate event of the Form. It is on this Event where you could check the value of the field and prevent the user from going away from this record (or from Saving) by returning "False"

E.g.
Function AXFormValidate(Sender)
If Not MyCustomValidationFunction() Then
'Issue Error Message (could be done inside the validation function)
'Set Focus to Field (could be done inside the validation function)
AXFormValidate = False
End If
End Function
[Reply][Quote]
Chris Burriss
Posts: 120
 
Re: Best way to perform field validation?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Oct 09 2:55 PM
I appreciate the feedback. AXFormValidate seemed to do the trick. If duplicated, I was unable to navigate to a different record, save the change, or close the main view. I think that covers all scenarios. Thanks for the suggestion!
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Best way to perform field validation?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Oct 09 3:00 PM
Glad to hear that the event is still there and functions properly, since as stated, I have built many customizations in the past that depend on it.



[Reply][Quote]
Bailey1
Posts: 57
 
Re: Best way to perform field validation?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Oct 09 9:23 AM
I was having the same issues, and I put my code in the AXFormValidate as well, but I am getting errors when I enter bad data and then just click onto another function such as Contact or Reports on the left nav bar. I get and error calling method AXFormValidate : "Cannot focus a disabled or invisible window". If I then exit out of SLX, the bad data is saved.
[Reply][Quote]
Chris Burriss
Posts: 120
 
Re: Best way to perform field validation?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Oct 09 8:14 AM
Bummer. I am not sure if I tested that scenario. I'll test what I've done to see if I get the same result.
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Best way to perform field validation?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Jun 10 8:31 AM
Just to confirm that an error\defect has been raised with SalesLogix concerning using the OnExit event of a control when the control is IN a panel. The onexit event fires TWICE when the control is in a panel, once when the control is on a form (or floating over a panel but not 'grouped' IN the panel).

We were getting false firings when the user clicked into a calculation field (Price * Quantity = Amount kinds of stuff) and then mouse clicked into the same field.

This has nothing to do with AXFormValidate which Raul pointed out is a great way to handle field validations prior to closing down a form.
[Reply][Quote]
Bailey1
Posts: 57
 
Re: Best way to perform field validation?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Sep 10 10:46 AM
Quote:
Originally posted by Bailey1

I was having the same issues, and I put my code in the AXFormValidate as well, but I am getting errors when I enter bad data and then just click onto another function such as Contact or Reports on the left nav bar. I get and error calling method AXFormValidate : "Cannot focus a disabled or invisible window". If I then exit out of SLX, the bad data is saved.
[Reply][Quote]
Bailey1
Posts: 57
 
Re: Best way to perform field validation?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Sep 10 10:46 AM
Quote:
Originally posted by Bailey1

I was having the same issues, and I put my code in the AXFormValidate as well, but I am getting errors when I enter bad data and then just click onto another function such as Contact or Reports on the left nav bar. I get and error calling method AXFormValidate : "Cannot focus a disabled or invisible window". If I then exit out of SLX, the bad data is saved.


Has anyone found a solution to this problem?
[Reply][Quote]
Bailey1
Posts: 57
 
Re: Best way to perform field validation?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Sep 10 10:47 AM
Quote:
Originally posted by Bailey1

I was having the same issues, and I put my code in the AXFormValidate as well, but I am getting errors when I enter bad data and then just click onto another function such as Contact or Reports on the left nav bar. I get and error calling method AXFormValidate : "Cannot focus a disabled or invisible window". If I then exit out of SLX, the bad data is saved.


Has anyone found a solution to this problem?
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 7/6/2025 11:14:11 AM