function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Getting id error



     I got the below error in visual force page. When we put the inputtext attribute as required=true. Please suggest any required messages to remove this id error message.


    j_id0:j_id1:j_id30: Validation Error: Value is required






Jim BoudreauxJim Boudreaux

code sample please...


Use the "id" attribute to specific a name, ie: "inputTextBox" for this inputText.


The error message would become:

"inputTextBox: Validation Error: Value is required"


When you set "required=true", it check if a value is entered. If not, it would throw this gives error message.


The other way is to remove the required attribute from the input text and put some JavaScript validation on page submit. In JavaScript check if that input text field is blank then show some alert message. Below is the sample code :


                <input  id="TextId" value=""  name="search_block_form" />

                <input value="Search" id="edit-submit-3" onclick="validate();">



                                function validate()


                                                var chapterName = document.getElementById('TextId').value;

                                                if(chapterName == '')

                                                alert('Chapter name is required.');