Reply from DeniseWhite on Jul 28 at 7:17 PM There are different trains of thought on things; unlike Curtis, I much prefer putting code on the record rather than the component. I find it easier to see at a glance what code I have. I also like my code as simple as possible, so I would not bother instantiating the record. Are you aware of what is called 'PeopleCode shorthand'? It saves you typing. A carat symbol (^) refers to the current field, and if you are referring to a field on the same record as where you are placing the PeopleCode, you can leave the record name off and only use the fieldname. When you save or validate the code, the system will automatically expand them to include the record.field notation. So, using Curtis' code as a basis, this is how I would enter it if you put it on SaveEdit of the first checkbox field: If ^= "N" and CHECKBOX2 = "N" and CHECKBOX3 = "N" then Error MsgGet(30000, 110, "Message 30000, 110 not found at MYRECORD.MYFIELD.SaveEdit"); End-if;
| | | ---------------Original Message--------------- From: Ken Duncan Sent: Friday, July 27, 2012 3:09 PM Subject: Preventing Row Insertion when 'Save' is Clicked From looking in the doc, it appears that I cannot call Error() from SavePreChange on the component, but I can call it in SaveEdit. Given a page with three checkboxes for unrelated items, I want to prevent the user saving a record if none of these checkboxes have been clicked. Should this give me what I want? rec1.field3.SaveEdit event: If None(Page1.pagefield1) AND Used for rec1.field1 None(Page1.pagefield2) AND Used for rec1.field2 None(Page1.pagefield3) Used for rec1.field3 THEN Error(30000,110, "Message Not Found"); End-If; My issue is that if none of the checkboxes are selected but the Save button is clicked, will the SaveEdit event run for each page field? Does this require each page field to have a name or is it sufficient to reference rec.field values in the record that is to be saved? Or, is there a different/better way to verify that at least one choice has been made on a page? Thanks. Ken | | Reply to this email to post your response. __.____._ | _.____.__ |
No comments:
Post a Comment