Power Apps Gallery 和在 Canvas 应用的表单中显示或隐藏提交按钮

huangapple go评论76阅读模式
英文:

Power Apps Gallery and Showing or Hiding the Submit Button inside a Form on Canvas App

问题

我有一个Power Apps画布表单,在其中我已经插入了多个画廊作为选中项目的复选框。这些在表单中都是必填字段。我还希望在提交按钮变灰时同时显示星号(STARVISIBLE)。因此,当用户填写表单时,我希望在DataCard的选择有效时星号(STARVISIBLE)消失,并且当表单准备好提交时,提交按钮显示颜色。

在表单中,默认的StarVisible可见控件 = And(Parent.Required, Parent.DisplayMode=DisplayMode.Edit)

画廊复选框控件解析为一个集合
OnCheck = Collect(MyProductsCollection, ThisItem)
OnUncheck = Remove(MyProductsCollection, ThisItem)

还有一个与复选框属性相关的变量,
Reset = IsReset

提交按钮的OnSelect控件设置为:

SubmitForm(Form4);
Set(
    IsReset,
    true
);
Set(
    IsReset,
    false
);
Clear(MyProductsCollection);
ResetForm(Form4);
Navigate(
    HOME,
    ScreenTransition.CoverRight
)

如何使StarVisible(星号)在提交按钮变灰时显示,并在表单准备好提交时隐藏?

在相同的情况下,如果我将原始的StarVisible的可见控件更改为
And(!Parent.Valid, Parent.DisplayMode=DisplayMode.Edit) ,则星号会立即隐藏,我无法提交表单。

有人可以提供帮助吗?

英文:

I have a Power Apps Canvas Form where I have inserted several galleries as checkboxes for items that are selected. These are all required fields in the form. I also want the asterisk (STARVISIBLE) to display at the same time the submit BUTTON is greyed out. So, when a user is completing the form, I want the asterisks (STARVISIBLE) to disappear when the selections for that DataCard are valid, and the submit BUTTON to display color when the form is ready to submit.

In the Form, the default StarVisible VISIBLE control = And(Parent.Required, Parent.DisplayMode=DisplayMode.Edit)

The gallery CHECKBOX controls are resolving to a collection
OnCheck = Collect(MyProductsCollection, ThisItem)
OnUncheck = Remove(MyProductsCollection, ThisItem)

There is also one variable on the CHECKBOX property,
Reset = IsReset

The submit BUTTON OnSelect control is set to:

SubmitForm(Form4);
Set(
    IsReset,
    true
);
Set(
    IsReset,
    false
);
Clear(MyProductsCollection);
ResetForm(Form4);
Navigate(
    HOME,
    ScreenTransition.CoverRight
)

How can I get the StarVisible (asterisk) to show when the Submit button is grey and to hide when the submit button is showing because the form is ready to submit?

In the same instance, if I change the original StarVisible's VISIBLE control to
And(!Parent.Valid, Parent.DisplayMode=DisplayMode.Edit) the asterisk is hidden immediately and I cannot submit the form.

Can anyone help?

答案1

得分: 0

StarVisible.Visible设置为!Form4.Valid,当您满足所有必填字段时(即当您的表单准备好时),它将消失。

如果您对按钮的DisplayMode有自定义逻辑,请使用SubmitButton.DisplayMode <> DisplayMode.Edit

另外,似乎您在重置表单时使用了冗余代码。请检查是否单独使用ResetForm() 可以实现相同的效果,而不必在表单内使用重置属性。

英文:

Set StarVisible.Visible to !Form4.Valid, it will disappear when you have satisfied all required fields (= when your form is ready).

If you have custom logic for the Button's DisplayMode, use SubmitButton.DisplayMode &lt;&gt; DisplayMode.Edit

Also, it seems you are using redundant code to reset your form. Check if ResetForm() alone achieves the same without using the Reset properties inside the form.

huangapple
  • 本文由 发表于 2023年3月4日 04:30:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/75631622.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定