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
JGFJGF 

Immediate attribute at Command Button partially working

Hello, I am having some problems making the following work.

I have an ApexTable that contains some required fields from an sObject. When pressing a button that will execute some extra functionality at the elements of the table, I need to prevent the validation message to appear at the required fields.

Placing the immediate attribute to the commandButton seems to work when I press the Button that appears at the top, but when I press the bottom one, the messages will still appear.

Given that the two buttons are the same as I declared it at the PageBlockButtons, I do not undestand what the problem may be.

Here is a photo of the situation. When pressing the"Add line" button, a new line will be created. When the bottom one is the pressed button, the validation errors will appear when it does not if I press the top one.

Validation appears when immediate = True
Here is the piece of code that declares the button:

<apex:commandButton
value="Add Line"
action="{!addNewLineItem}"
onclick="loadingSpinner(true);"
oncomplete="loadingSpinner(false);"
reRender="tableItems,errorMessage"
rendered="{!showAddLineButton}"
immediate="true"
/>

*loadingSpinner is a Javascript method that places a loading image at the page until the process ends.

Can someone give a hint on whato check?
JGFJGF
For now, until I find a proper reason and solution I found an ugly workaround.

Just duplicate the PageBlockButton portion of the Page, then to the first one add location="top" and to the second location="bottom". This way the buttons will work as they should.