0

Please help me how to hide or remove the asterisk(*) for required tag field (added in select tag, it will display as required field) in Lightning component form

<lightning:select aura:id="job2" value="{!v.shows[1].Function__c}" onchange="{!c.handleOnChange2}" name="job2" required = "true" messageWhenValueMissing = "This field is required.">
1
  • Why would you want a required field not to be marked as required in the UI? That's usually considered a hostile UX experience.
    – sfdcfox
    Nov 30, 2021 at 17:08

1 Answer 1

1

Remove the required attribute and validate the form when it is submitted.

8
  • Required is mandatory when you use <lightning:select> for showing the error message Nov 30, 2021 at 12:21
  • 1
    Then don't use that attribute. Display the message elsewhere on your page after you validate the form data when it gets submitted. Nov 30, 2021 at 12:26
  • For picklist values, I need to use that attribute!! Nov 30, 2021 at 12:29
  • 1
    Then you can't remove it either of them. What you could do is implement your own select component then. Nov 30, 2021 at 12:31
  • Please check here salesforce.stackexchange.com/questions/223055/… Nov 30, 2021 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.