角色形式,如果p-select与原始值保持不变,则形式无效

发布于 2025-01-31 21:52:11 字数 177 浏览 5 评论 0原文

我的要求是禁用提交按钮,直到用户更改表单控件的任何任何形式控件为止,问题是很容易处理所需字段的输入字段,但是另一个控件是选择控制,并且基于设置有三个选项,选择了这三个选项中的任何一个,如果用户未更改此选择字段中的选项,则应该禁用提交按钮。是否有任何可以为此提供帮助的内置验证器吗?还是没有任何自定义验证器? 我尝试了很少的验证器,但没有解决

my requirement is to disable the submit button until user changes any of the form control, the issue is the input fields which is a required field is easily handled, however the other control is a select control, and there are three options, based on settings, any of the three options is selected, if the user doesn't change the option in this select field then the submit button should remain disabled. is there any inbuilt validator that can assist for this? or if not any custom validator?
I have tried few validators but it didn't work out

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一抹苦笑 2025-02-07 21:52:11

添加验证器。需要到您的选择控件应该足够

Adding Validators.required to your select control should be sufficient

甜`诱少女 2025-02-07 21:52:11

您可以使用form.valuechanges.subscriber(res => {//您的代码在此处启用并禁用submipt button}))在反应性表单中,

这将有助于您观看表单中的任何更改

you can use Form.valueChanges.subscribe(res=>{//your code here to enable and disable the submit button}) in reactive forms

this will help you to watch any change in the form

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文