i am facing a JavaScript based field validation problems in Salesforce. First let's give you my code snippet.


<apex:inputField value="{!dealObject.Name}" required="true" />

But when i try to click on any button/link on my VF page it shows me an error message as shown in following image: enter image description here

For example if if click on my commandButton to do something or even click on simple HTML button to call JavaScript function this message appears. This problem occurrs for every required field, even if i don't explicitly add required attribute. BTW i am on Partner Developer Edition.

My question is how i can disable this functionality or go around it somehow.

NOTE: I am not using any validator plugin.

  • Can you please provide your vf code to understand it better. Commented Feb 12, 2014 at 7:37
  • i asked a similar question a while ago you can view some more details there. salesforce.stackexchange.com/questions/27156/… Commented Feb 12, 2014 at 7:43
  • It must be happening due to some external jquery/javascript, You should check your generated html markup because i never seen such popup in salesforce for validation errors. Commented Feb 12, 2014 at 7:55

5 Answers 5


Try making the apex command buttons(which are giving the required field error) Attribute immediate="true" as follows,

< apex:commandButton immediate="true" name="xyz" action="{!someAction}">
  • immediate=true works good when we want to avoid server based validations but in my case this is a client based validation that js will not even let form submit before server is contacted. So it doesn't work here. :( Commented Feb 12, 2014 at 7:21
  • 1
    immediate=true discards any user input, so is only really of use if you want to allow the user to cancel out of the object create/edit. Commented Feb 12, 2014 at 8:26

remove required="true" from all fields.

<apex:inputField value="{!dealObject.Name}"/>
  • i am using inputField so even if i don't declare required attribute it will automatically mark it as required after checking it from object. Commented Feb 12, 2014 at 6:58
  • you are actually declaring it as require, look at required="true" in your code. Commented Feb 12, 2014 at 7:00
  • i know. But as i said 'even if i don't' inputField automatically marks a field as required after checking it from Object. Commented Feb 12, 2014 at 7:22

Probably you can just set required="false" ? This should take out the validation from the inputfield.


I'd be nervous of trying to disable this validation by working around the JavaScript, as if Salesforce change the way that it works the field would suddenly become required again.

I typically replace the <apex:inputField /> with an <apex:inputText /> component - that way you can bind to an sobject field but avoid the required nature of the it. E.g.

<apex:inputText value="{!dealObject.Name}" />

You'll have to provide your own label in this instance and if you were to use it on something like a date field you would lose any additional functionality such as a date picker.


I found out what the problem was. This is being caused by HTML 5 form validation performed by browsers. So it isn't salesforce related issue. I just had to disable HTML 5 form validation and it worked. for more information https://stackoverflow.com/questions/3090369/disable-validation-of-html5-form-elements

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .