I have several input control fields, two text inputs and two dropdowns. The text inputs are called NamePicker and PricePicker and the dropdowns are called CategoryPicker and ColorPicker. Below that I have a button that contains the following if statement:
(SPProductList is the name of my SharePoint connector)
UpdateContext({error:""});;
If(
NamePicker in SPProductList.'Name (Title)';
UpdateContext({error: "nameexists"});
IsEmpty(NamePicker.Text);
UpdateContext({error: "emptyname"});
IsEmpty(CategoryPicker.SelectedText.Value);
UpdateContext({error: "emptycategory"});
IsEmpty(PricePicker.Text);
UpdateContext({error: "emptyprice"});
IsEmpty(ColorPicker.SelectedText.Value);
UpdateContext({error: "emptycolor"});
error="";
UpdateContext({SaveAttempt: true})
)
This is the layout:
As you can see, the text input fields contain only hint text, which I don't check for. Nevertheless, the button continues with UpdateContext({SaveAttempt: true}), which I don't want in that case. When I added a label with the visible property "IsEmpty(NamePicker)", it remained invisible even though it should be visible.
Is there something I'm missing or doing wrong here? Any advice is much appreciated!