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
SimrinSimrin 

Command button not firing properly

<apex:commandButton id="search" styleClass="search" action="{!search}" image="{!URLFOR($Resource.search)}" style=" height: 50px;  width: 50px;"> </apex:commandButton>   

    public void search() {
        system.debug('###'+typeSelected+'#'+category+'#');
    }
I have two select list aboove in the page.
When i click on selectList, i can get values but when i press command button. the search fucntion  is not executed at all
 
Best Answer chosen by Simrin
ManojjenaManojjena
Hi Simrin ,

Add reRender  it will work .
<apex:image id="search" value="{!URLFOR($Resource.search)}" styleClass="search" onclick="callSearch('{!$Component.type}','{!$Component.category}');" reRender="idForm"/>

Else rerender some component which you want to reload .

All Answers

SantoshChitalkarSantoshChitalkar
Hi Simrin,

I am just guessing, try changing the method name, Id name and styleclass. I am saying this because I think Search is keyword.

Let me know.

Regards,
Santosh
SimrinSimrin
i tried to change the names but still the same result. It refreshes the page but dont call the controller
SantoshChitalkarSantoshChitalkar
can you paste both code here?
ManojjenaManojjena
Hi Simrin,

Can  you try by removing styleclass attribute .As  both styleclass and style is there in one component it will create problem .

Thanks 
Manoj
Ashish_Sharma_DEVSFDCAshish_Sharma_DEVSFDC
Hi Simran,

It seems to be no issue with your commandbutton .Can you paste your complete code here ?

 
SimrinSimrin
<apex:image id="search" value="{!URLFOR($Resource.search)}" styleClass="search" onclick="callSearch('{!$Component.type}','{!$Component.category}');"/>

is the command button like feature i was trying, I need command button
ManojjenaManojjena
Hi Simrin ,

Add reRender  it will work .
<apex:image id="search" value="{!URLFOR($Resource.search)}" styleClass="search" onclick="callSearch('{!$Component.type}','{!$Component.category}');" reRender="idForm"/>

Else rerender some component which you want to reload .
This was selected as the best answer
SimrinSimrin
It is already present in the code.  image doesnt have reRender property and its already added to action function.