Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, November 30, 2024 
 
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 - Controls
Forum to discuss usage & tips for SalesLogix controls and other 3rd party ActiveX controls. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to Controls | New ThreadView:  Search:  
 Author  Thread: Validation of input-controls
Marty05
Posts: 68
 
Validation of input-controlsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Dec 07 5:27 AM
hi,
i am rather new to SLX-development, so sorry about my maybe simple question...

i'm having a vb-form with several input fields. in a databased there can be found under which cirumstances which control is enabled and has to be validated / filled.

setting a control enabled on basis of this DB works fine. now my questions are:
+ i would like to use the "required" attribute of a controle to ensure that data is entered. when will this attribute be parsed by SLX? in mbOK-Button-Event? i have set the controls atribute required to true, but still nothing happens...

+ i would like to ensure that data is entered in correct format - therefor i used the "formatType"-attribute of a controle. If i set a field as "ftInteger" and enter a string, it converts the string to "0" - but if you print the .text-attribute of this controle, the string still is provided, not "0". what else do i have to do to ensure type safety in controls?

thanks for you help!
[Reply][Quote]
Vladimir
Posts: 93
 
Re: Validation of input-controlsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Dec 07 6:21 AM
Property "required" work with data forms only.
You can validate data of controls in the OnValidate event of form. It's lunch before store data.
[Reply][Quote]
Marty05
Posts: 68
 
Re: Validation of input-controlsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Dec 07 6:27 AM
>You can validate data of controls in the OnValidate event of form

but i have to do it manually there? i liked SLX to do it for me (not the content, just the type of data, e.g. numer is really a number; date is really a date et et) - is this possible?
[Reply][Quote]
Vladimir
Posts: 93
 
Re: Validation of input-controlsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Dec 07 6:30 AM
You need do it manually. Property "Format" of control set "show format".
[Reply][Quote]
Marty05
Posts: 68
 
Re: Validation of input-controlsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Dec 07 6:32 AM
i hoped to hear something different...

anyway, thanks for the fast reply - i will see what i can do, maybe i will have some more questions later
[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: Validation of input-controlsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Dec 07 4:20 PM
This is the sort of thing you need ...

Function AXFormValidate(Sender)
AXFormValidate = True

If [validatiion fails] then
MsgBox [error details]
AXFormValidate = false
Exit Function
End If

End Function
[Reply][Quote]
Marty05
Posts: 68
 
Re: Validation of input-controlsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 06 Dec 07 6:30 AM
thank you, works fine!

just one question: the ".FormatType" and ".FormatString" - attribute of an TEdit - how does it work? Can I use it to enforce a certain format of input-data (e.g. a number, a date, ...)?

if i have to manually check the data format - what is this attribute good for?
[Reply][Quote]
Jeff Weight
Posts: 219
 
Re: Validation of input-controlsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 06 Dec 07 10:33 AM
The two properties you mentioned are masks - they only dictate how the data is seen, not how the data is entered. You can see an example of this on the account screen, under main phone. If you put your cursor in the status field, you can see the phone number formatted (in the U.S., it look like (555)555-5555). If you click the cursor in the main phone field, the formatting goes away and you can see the actual "data" that's in the field, which should look like 5555555555 (if it is stored in the database correctly).

If you are concerned about making sure the user only enters certain characters into the field, use the OnKeyPress event. Each time the user presses any key in the field, it fires this event. I have used this numerous times to make sure users only enter in numbers. Here's an example from my code of an OnKeyPress event:

Sub YourFieldNameOnKeyPress(Sender, Key)
If Not IsNumeric(Chr(Key)) AND Key <> 8 Then Key = 0
End Sub

The function basically says that if the key pressed isn't numeric and isn't the backspace key, then change the keystroke to 0, which means nothing is entered into the field. Works like a charm!
[Reply][Quote]
Marty05
Posts: 68
 
Re: Validation of input-controlsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Dec 07 1:21 AM
thank you!
[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 © 2024 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): 11/30/2024 10:44:46 AM