You need to sign in to do that
Don't have an account?
vandana raju
call apex method on keypress event
Hello
I having a custom object C1 with fields like name,email and mobile number.On an visualforce page I will enter the values and save the data.This part is fine with me.
Now my requirement is when I enter email in <apex:inputfield> say on keypress event I should be able to call an server side method in apex controller.
This method will check if the email already exists in object. If it exists then some action needs to be taken.
Please anybody any help will be greatly appreciated
thanks
vandana
I having a custom object C1 with fields like name,email and mobile number.On an visualforce page I will enter the values and save the data.This part is fine with me.
Now my requirement is when I enter email in <apex:inputfield> say on keypress event I should be able to call an server side method in apex controller.
This method will check if the email already exists in object. If it exists then some action needs to be taken.
Please anybody any help will be greatly appreciated
thanks
vandana
OnKeyPress may not be the suitable event for you to validate the Email address.
You have to use onblur event of the <apex:inputfield> component and setup an apex:actionFunction to make a callback to your APEX method.
Your code will approximately look like this. Hope this helps.
Here is simple example to call action:function
http://salesforceglobe4u.blogspot.com/2017/05/actionfunction-in-salesforce.html
Let me know if u need any further help.