4D v13.4REJECT |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v13.4
REJECT
REJECT
REJECT has two forms. The first form has no parameters. It rejects the entire data entry and forces the user to stay in the form. The second form rejects only aField and forces the user to stay in the field. Note: You should consider the built-in data validation tools before using this command. The first form of REJECT prevents the user from accepting a record that is not complete. You can achieve the same result without using REJECT — you associate the Enter key with a No Action button and use the ACCEPT and CANCEL commands to accept or cancel the record, after the fields have been entered correctly. It is recommended that you use this second technique and do not use the first form of REJECT. If you use the first form, you execute REJECT to prevent the user from accepting a record, usually because the record is not complete or has inaccurate entries. If the user tries to accept the record, executing REJECT prevents the record from being accepted; the record remains displayed in the form. The user must continue with data entry until the record is acceptable, or cancel the record. The best place to put this form of REJECT is in the object method of an Accept button associated with the Enter key. This way, validation occurs only when the record is accepted, and the user cannot bypass the validation by pressing the Enter key. The second form of REJECT is executed with the field parameter. The cursor stays in the field area. This form of REJECT forces the user to enter a correct value. It must be used immediately following a modification to the field. You can test for modification by using the Modified function. You can also use REJECT in the object method for the data entry area. This command has no effect on fields in subform areas. You must put either form of the REJECT command in the form method or object method for the form that is being modified. If you are using REJECT for the subform’s Detail Form for a table, put it in the form method or object method for the Detail Form. You can use HIGHLIGHT TEXT to select the data in the field that is being rejected. The following example is for a bank transaction record. It shows the first form of REJECT being used in an Accept button object method. The Enter key is set as an equivalent for the button. This means that even if the user presses the Enter key to accept the record, the button’s object method will be executed. If the transaction is a check, then there must be a check number. If there is no check number, the validation is rejected: Case of The following example is part of an object method for an [Employees]Salary field. The object method tests the [Employees]Salary field and rejects the field if it is less than $10,000. You could perform the same operation by specifying a minimum value for the field in the form editor: If([Employees]Salary<10000) |
PROPERTIES
Product: 4D
INDEX HISTORY
Created: < 4D v6 SEE ALSO |
||||||||||||||||||||||||||||||||||||||||||||||||||||||