You need to sign in to do that
Don't have an account?
Visualforce.remoting.Manager.invokeAction() not working
Hello there,
I am using Javascript remoting in my Project.
Apex code:
@RemoteAction
public static String ConfirmZip(String strZipCode)
{
List<Partner_Postal_Code__c> lstPostalCode = Partner_Postal_Code__c.getall().values();
Boolean bIsNrToPrtnr = false;
Integer iPartnerCount = 0;
Set<Partner_Postal_Code__c> lstPrtnrPostalCode;
String strUrl;
for( Partner_Postal_Code__c postalCode : lstPostalCode )
{
if( strZipCode == postalCode.Postal__c )
{
lstPrtnrPostalCode.add(postalCode);
bIsNrToPrtnr = true;
}
else
bIsNrToPrtnr = false;
if( bIsNrToPrtnr )
iPartnerCount += 1;
}
if( lstPrtnrPostalCode != null && lstPrtnrPostalCode.size() > 1 )
return 'SelectPartnerOnRegPopUp?id=strZipCode';
else
return null;
}
Visualforce Code:
<script type="text/javascript">
function partnerPopUpForZip(field)
{
var StrZipCode = '';
StrZipCode = document.getElementById(field).value;
alert(StrZipCode);
Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.VolunteerRegistration.ConfirmZip}', '411016',
function(result, event)
{
if(event.status)
{
var = result;
alert(result);
prtnrPopUp = window.open(url,'wndAddItems','scrollbars=1,width=480,height=360,resizable=1');
prtnrPopUp.moveTo(iTop,iLeft);
}
},
{escape: true}
);
}
</script>
Code to call javascript method:
<td>
<apex:inputText value="{!Volunteer.MailingPostalCode}" id="zipe" styleClass="textSmall" onblur="javascript:partnerPopUpForZip('{!$Component.zipe}');" />
</td>
The page loads properly. But, whenever I call that Javascrpt method through OnBlur event it says 'partnerPopUpForZip is not defined'.
Please help.
Thanks in Advance.