You need to sign in to do that
Don't have an account?
'oncomplete' not working for my 'actionfunction', please help
Below is my code: the oncomplete function of my actionfunction is not throwing allert.
Can someone help?
<div>
<apex:inputCheckbox id="abc1" value="{!ss.IsCompleted}" onclick="javascript:updateLobStg('{!ss.LobStageId}', this,'{!ss.Description}');"/>
</div>
<script>
function updateLobStg(lobStgId,checkBox,description){
var isChecked = $(checkBox).is(':checked');
/*------ some code----*/
af_updateLobStage(lobStgId,isChecked);
</script>
<form>
<apex:actionfunction name="af_updateLobStage" status="counterStatus" action="{!updateLobStage}" oncomplete="window.alert('clicked')">
<apex:param name="lobStgId" value="" assignto="{!selectedLobStageId}"/>
<apex:param name="isChecked" value="" assignto="{!isLobStageCompleted}"/>
</apex:actionfunction>
</form>
There is no error on the controller side and its executing fine.
It should work. oncomplete code is correct. It is working in one of my actionfunction. I think there may be some error in the Javascript, resulting in not showing that alert.
You can check that in
Tools -> WebDevelper -> Error Console
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
problem might be in '{!ss.Description}'
if ss.Description contains multiline or other "non-valid" chars, it corrupts your java script...
you should use JSENCODE for textfields
'{!JSENCODE(ss.Description)}'
The values which i am passing in the actionfunction to the controller is getting processed and is updating the records perfectly as expected.
Its just that I am not able to get anything done on 'oncomplete'