pfc_Validation 事件编码示例
您能给我一个如何在 pfc_Validation
事件中编码的示例吗?这是我从未使用过的事件。例如,这是我在 ue_itemchanged 事件中编码的内容。
if dwo.name = 'theme' then
This.Setitem(row,"theme",wf_clean_up_text(data))
end if
if dwo.name = 'Comments' then
This.Setitem(row,"Comments",wf_clean_up_text(data))
end if
在 pfc_Validation
事件中编码这些验证的正确方法是什么,以便它们仅在保存时执行?
Could you give me an example of the way I should code into the pfc_Validation
event? This is an event that I have never used. For example here is something I have coded in the ue_itemchanged
event.
if dwo.name = 'theme' then
This.Setitem(row,"theme",wf_clean_up_text(data))
end if
if dwo.name = 'Comments' then
This.Setitem(row,"Comments",wf_clean_up_text(data))
end if
Which is the proper way of coding those validations in the pfc_Validation
event , so that they are performed only on save-time?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在询问本机 PowerBuilder 之外的问题,因此不能保证我的假设是正确的。 (例如,任何人都可以创建 pfc_Validation 事件,并在用户用鼠标画圆时触发该事件)有一个 pfc_Validation 事件编码为 PowerBuilder 基础类中逻辑工作单元 (LUW) 服务的一部分(PFC)。如果您想了解更多信息,我写了一篇文章 在 LUW 上。
首先,你的问题:LUW 服务中的所有内容都只会在保存时触发,所以你在那里状态良好。
话虽如此,从代码来看,这不是验证,而是为更新准备数据。在此基础上,我建议该逻辑的适当位置是 pfc_UpdatePrep。
至于转换代码,非常简单。 (现在,看我把事情搞砸了。)
祝你好运,
特里。
You're asking something outside of native PowerBuilder, so there's no guarantee my assumptions are correct. (e.g. anyone could create a pfc_Validation event and have it fire when the user draws circles with his mouse) There is a pfc_Validation event coded as part of the Logical Unit of Work (LUW) service in PowerBuilder Foundation Classes (PFC). If you want to find out more about it, I've written an article on the LUW.
Firstly, your question: Everything in the LUW service is only fired at save time, so you're in good shape there.
Having said that, from the looks of the code, this isn't validation, but data preparation for the update. On that basis, I'd suggest the appropriate place for this logic is pfc_UpdatePrep.
As for converting the code, it's pretty simple. (Now, watch me mess it up.)
Good luck,
Terry.