To mark a field is required with red *

Hi, how can I mark a field that is mandatory with a red *?

Hi there,

You may check out:

Or simply add the asterix (or red border) by testing for valid input in code with IF statements.

Can you share what you have tried?

3 Likes

One way is, if you have a label and a text box together, to add an icon to the label (eg fa:star) and set icon_align to right (either in code or in the properties in the IDE).

@alcampopiano beat me to it :slight_smile:

3 Likes
self.validator.require_text_field(self.my_text_field, self.label_to_display_if_invalid)

what if I have dropdown field that is mandatory , how to I modify this command?
“self.validator.require_dropdown_field(self.dropdown_name, self.dropdown_label)”

focus on the bold part, thanks!

similar question, how about a upload field that is mandatory? how to modify the command?

If you could kindly show an example of what you have attempted so far we would be happy to provide assistance. Perhaps you could share a clone link or a somewhat complete block of code (this is good practice on the forum).

This was something I did a little while back:

@owen.campbell I don’t see ‘Configure roles’ when I go to ‘Theme’ --> ‘Assets’. Was that removed?

You configure roles in Theme -> Roles

I don’t recall it even being under assets (though I am old and peculiar).

2 Likes

I am old enough to be bordering on senile. That may have been correct at time of press or might simply be the onset of variant CJD.

1 Like

Was this question answered? Can radio buttons be required?

In the general case, I typically add a Label, color it “red”, and set its text to “*”, then place the label where it belongs.