-1

对于在第二个渐进式分析屏幕上单击提交按钮后的 JS 自定义事件event==='afterSubmit',整个事件不断重复,直到我关闭它。我e.stopImmediatePropagation();用来停止此事件,但它没有任何提示?

4

1 回答 1

0

我看到的一件事是,由于您正在使用 afterSubmit 事件,并在其中调用 accounts.showScreenSet ,每次您在新屏幕上按下提交时,它都会再次调用该事件。这可能不是想要的行为。

其次,最好仅在您检查的字段为空而不是满时才触发屏幕。现在的方式意味着如果用户已经填写了该字段,屏幕将始终触发。

你可以试试这个:

if (e.eventName === 'afterSubmit') {

                alert('afterSubmit Fired');

                if (typeof (e.profile.zip) !== 'undefined') {
                    if ((e.profile.zip == '') || (e.profile.zip == null)) {
                        alert('Yo 2nd step..');
                        alert('Zip is empty, please fill out your zipcode on the next screen');

                        gigya.accounts.showScreenSet({
                            screenSet: 'New-RegistrationLogin',
                            startScreen: 'Bio'
                        });
                    }
                }
            }

此外,在向现有用户的配置文件添加附加信息时,建议最佳做法是使用 ProfileUpdate 屏幕集中的屏幕,而不是 RegistrationLogin 屏幕集中的屏幕。

于 2017-04-24T13:56:46.820 回答