关于缺失数据的另一个验证问题 [英] Yet another validation question on missing data

查看:61
本文介绍了关于缺失数据的另一个验证问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几乎已经使用大型应用程序完成了,现在可以很好地使用.验证屏幕上的内容很时髦,但需要一些努力才能正常进行.

Almost done with the huge app, now working on the nice to haves. Validation of what is on the screen is funky but works ok with some effort.

现在,我必须有一种方法来判断用户是否在总体注释文件中输入了两个强制性注释,一个用于问题,一个用于解决问题,该注释文件具有基于声明/问题,声明/解决方案的密钥.在普通平铺上输入注释 添加评论屏幕.

Now I have to have some way of telling if the user has entered two mandatory comments, one for problem, one for resolution in an overall comments file that has a key based on claim / problem, claim / resolution. The comments are entered on the normal tiled add comment screen.

如果用户未输入任何内容且未保存数据,我该如何判断部分所需的交易丢失了?

If the user did not enter anything and the data has not been saved how can I tell part of the desired transaction is missing?

由于这是整体保存的一部分,我该如何告诉用户他们错过了输入两个记录的机会?

Since this is part of the overall save how can I tell the user they missed entering two records?

谢谢!

Konrad U

推荐答案

为进行验证,您有几种选择.

For validation you have several options. 

1.在您要验证的必填字段的情况下,请在实体设计器中将该字段标记为必填字段,它将强制执行该验证.

1.  In your case, where you are trying to validate a required field, mark the field as required in the entity designer and it will enforce that validation.

2.在服务器上编写验证代码.有很多示例,所以我不再赘述.

2. Write validation code on the server.  There are plenty of examples so I won't go into that.

3.在客户端上编写验证代码.这可能就是您想要的,因为您说过要在记录实际保存之前进行验证.一种简单的方法是使用要验证的属性的后期渲染功能. 这是AddEditOrder屏幕上必填字段的简单示例:

3. Write validation code on the client.  This may be what you want since you said you want validation to occur before the record is actually saved.  An easy way to do it is to use the post render function of the property you want to validate.  Here is a simple example of a required field on an AddEditOrder screen:

结果如下:

当用户在项目"字段中输入文本时,验证结果将消失,并且可以保存记录.希望这会有所帮助.

When the user enters text for the Item field, the validation result will go away and they can save the record.  Hope this helps.


这篇关于关于缺失数据的另一个验证问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆