我不知道这个livecycle检查电子邮件地址的函数做错了什么。Livecycle控制台返回"ReferenceError: emailAddress未定义“的错误,即使该函数将触发警报或xfa.host.messageBox。你能告诉我为什么在运行完这个函数后不能定义全局变量emailAddress吗?耽误您时间,实在对不起。
function fxemailverification(emailAddress) {
var r = new RegExp("^[A-Za-z0-9_\\-\\.]+\\@test.com");
// Test the rawValue of the current object to see if it matches the new RegExp
var result = r.test(emailAddress);
if (result == false) {
var emailAddress = "";
alert("You have entered an invalid Email address. \nAll email addresses must end in '@test.com'.", "Email Verification", 4, 0);
}
return emailAddress;
};
textfield1.rawValue = fxemailverification(emailAddress);发布于 2013-06-22 01:41:59
emailAddress变量只存在于函数内部,但您试图从外部访问它。它超出了范围。不知道你在找什么,也许是这个?
var emailAddress = "";
function fxemailverification(emailAddress) {
var r = new RegExp("^[A-Za-z0-9_\\-\\.]+\\@test.com");
// Test the rawValue of the current object to see if it matches the new RegExp
var result = r.test(emailAddress);
if (result == false) {
emailAddress = "";
alert("You have entered an invalid Email address. \nAll email addresses must end in '@test.com'.", "Email Verification", 4, 0);
}
return emailAddress;
};
textfield1.rawValue = fxemailverification(emailAddress);https://stackoverflow.com/questions/17241224
复制相似问题