You need to sign in to do that
Don't have an account?

Red bar of the input field
In my page, there are some field are required the users to insert. However, I cannot use the required="true" method in the apex:inputfield. Because this will lead to a standard error message, which cannot shows with the custom error message at the same time. Thus, I remove all the checking in the system and setup checking in the apex code, to generate a custom error message. Is there any althernative to show the red bar in order to alert the users? Thanks.
If you want to use the customized Red bar to alert the users as required field, you can try below snippet: Also find below the Sample VF page using above snippet and Screenshot of the output.
VF Page: Preview of above VF Page code:
Please let me know if that helps you.
Best Regards,
BALAJI
All Answers
If you want to use the customized Red bar to alert the users as required field, you can try below snippet: Also find below the Sample VF page using above snippet and Screenshot of the output.
VF Page: Preview of above VF Page code:
Please let me know if that helps you.
Best Regards,
BALAJI
Happy to hear it worked :-)
Here, we are using the Standard style of Salesforce by name "requiredInput" and "requiredBlock" and here (http://blog.jeffdouglas.com/2008/11/16/displaying-the-required-red-bar-for-a-control/) is the reference for it.
We can also create Custom stylesheets to customize more, For example: if we want the required bar to be coloured as some other than red, we can go for custom style sheets.
Please find below modified sample VF Page for required bar using custom stylesheets and Output screenshot:
VF Page:
Preview of above VF Page code:
Note that in style, I have given color as blue, so required bar is in blue color.
Best Regards,
BALAJI