问题
I have the following js implemented in Gigya JavaScript Parameters:
onAfterScreenLoad: function(event) {
if ((ell = document.querySelector("#gigya-forgot-password-screen input[type=text][name=loginID]")) != null){
ell.setAttribute('type', 'email');
ell.setAttribute('placeholder', 'user@example.com');
ell.setAttribute('autocomplete', 'off');
}
},
I am able to use the above code to handle the fields of all other screen-sets EXCEPT this "Forget Password" screen (i.e. Screen ID: gigya-forgot-password-screen) in Screen-sets ID "Default-LinkAccounts". It looks like the forgot password flow is triggered without a user session and independently of the information passed into the Email field on the login screen. If it is, then how to implement this.
回答1:
it seems the name of the field is different depending upon which screen you are using:
window.ell = document.querySelector("#gigya-register-screen input[type=text][name=email]");
window.ell = document.querySelector("#gigya-login-screen input[type=text][name=username]");
window.ell = document.querySelector("#gigya-forgot-password-screen input[type=text][name=username]");
so:
onAfterScreenLoad: function(event) {
var ell = null;
if ((event.currentScreen === "gigya-forgot-password-screen") || (event.currentScreen === "gigya-login-screen")) {
ell = document.querySelector("#" + event.currentScreen + " input[type=text][name=username]");
} else if (event.currentScreen === "gigya-register-screen") {
ell = document.querySelector("#gigya-register-screen input[type=text][name=email]");
}
if (ell != null){
ell.setAttribute('type', 'email');
ell.setAttribute('placeholder', 'user@example.com');
ell.setAttribute('autocomplete', 'off');
}
}
来源:https://stackoverflow.com/questions/47875538/in-gigya-unable-to-set-attribute-in-email-of-screen-forget-password-in-scre