January 5, 200917 yr I can paste any length of text into that field. Maybe change the script step to: Set Field [ field; Left(field;10) and change the trigger to OnObjectModify?
January 5, 200917 yr Another way to approach this is to just disallow any key presses besides navigation keys after 10 characters have been entered. I love script triggers they are definitely going to provide many different, interesting approaches to a problem MaxLengthTest.zip
January 5, 200917 yr Author Hi JesseSFR your example suffers the same problem of mine: you can paste how many chars you want.
January 5, 200917 yr [color:red]Everyone please remember that the event triggers are not data validation tools. They work only on a specific instance of a field on a specific layout. If you need field validations, use the options in Manage Database.... Steven
January 6, 200917 yr Author Maybe change the script step to: Set Field [ field; Left(field;10) and change the trigger to OnObjectModify Yes, it seems a lot better... just I changed the script to: Set Field [ Left ( Get ( ActiveFieldContents ) ; 10 ) ] So it can be used on every field I wish.
January 6, 200917 yr Author [color:red]Everyone please remember that the event triggers are not data validation tools. Hi Steven that wasn't a validation use of triggers... It was only a way to stop the user entering data into a field.
January 6, 200917 yr that wasn't a validation use of triggers... It was only a way to stop the user entering data into a field. Same concept applies. If the field is elsewhere accessible, then the process does not work. Steven
January 6, 200917 yr Author Hmmm... If the field is elsewhere accessible, I'll attach it the same trigger.
January 6, 200917 yr And you can still attach validation to it to be sure. But the trigger is a nice interface option.
January 9, 200917 yr ... and an auto enter to truncate the input. But Steven is absolutely right, the way triggers are implemented is ONLY about user interface, not about data integrity/security. There are many ways of working around a 'trigger protected field' (Set Field script step, new field object on layout, including adding it to a table view...)
Create an account or sign in to comment