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
Vivekh88Vivekh88 

Onchange event in Visualforce not working

Hi,

i want to fire onchange event without going out of input text box and save the values.
Onchange fucntion works whenever i enter a field value and click somewhere outside and then save.
Is there any other event to make this scenario possible?

User-added image

My code:
<b style="vertical-align:inherit">New: </b>
<apex:InputField style="height:70px;width:180px;" value="{!a.acc.Updates__c}" rendered="{!disableInput}" id="updatetext">
          <apex:actionSupport event="onchange" action="{!handleUpdateChange}" reRender="AccDMLTable">
                   <apex:param id="updval" name="updval" value="{!a.acc.ID}" assignTo="{!objSelectedStudentId1}"/>
         </apex:actionSupport>
</apex:inputField>

Thanks
Vivekh
Prosenjit Sarkar 7Prosenjit Sarkar 7
Hi Vivekh,

Events supprted for actionsupport are , "onblur", "onchange", "onclick", "ondblclick", "onfocus", "onkeydown", "onkeypress", "onkeyup", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "onselect". On your case only "onchange" and "onmouseout" can be useful. But in case of "onchange" I think it is the behaviour what you are getting right now.

Thanks,
Prosenjit
Vivekh88Vivekh88
Thanks prosenjit. 'onmouseout' is working but when we move the more over the field which i have not modified that field is also getting saved.
Vasani ParthVasani Parth
Try this,
<b style="vertical-align:inherit">New: </b>
<apex:InputField style="height:70px;width:180px;" value="{!a.acc.Updates__c}" rendered="{!disableInput}" id="updatetext" />
          <apex:actionSupport event="onchange" action="{!handleUpdateChange}" reRender="AccDMLTable">
                   <apex:param id="updval" name="updval" value="{!a.acc.ID}" assignTo="{!objSelectedStudentId1}"/>
         </apex:actionSupport>
Please mark this as the best answer if this helps
Vivekh88Vivekh88
Hi Vasani,

Its not working
Prosenjit Sarkar 7Prosenjit Sarkar 7
Hi Vivekh,

You can wrap the whole code within <apex:actionRegion> that means, 
 
<b style="vertical-align:inherit">New: </b>
<apex:actionRegion>
	<apex:InputField style="height:70px;width:180px;" value="{!a.acc.Updates__c}" rendered="{!disableInput}" id="updatetext">
		  <apex:actionSupport event="onmouseout" action="{!handleUpdateChange}" reRender="AccDMLTable">
			   <apex:param id="updval" name="updval" value="{!a.acc.ID}" assignTo="{!objSelectedStudentId1}"/>
		 </apex:actionSupport>
	</apex:inputField>
<apex:actionRegion>

you can use this snippet.

Thanks
Prosenjit
Vivekh88Vivekh88
Hi Prosenjit,

I tried adding <apex:actionRegion> but still facing the same issue. 

Thanks
Vivek