gpt4 book ai didi

java - Primefaces 向导。如何返回onnext的js函数选项卡

转载 作者:行者123 更新时间:2023-12-01 14:51:52 27 4
gpt4 key购买 nike

我使用 Primefaces 3.5。并尝试在<p:wizard/>的onnext处理程序中调用js函数。我希望在当前选项卡验证结果后,onnext 返回特定选项卡上的选项卡。我的验证函数

    function validateManageOtherTournaments(wizard, validationTab, lang) {
var currentTabId = validationTab;
if (currentTabId != 'competitionId') {
return wizard.next();
}

var seasonVal = document.getElementById('manageTournament:name_season_input').value;
var dateFromVal = document.getElementById('manageTournament:dateFrom_input').value;
var dateToVal = document.getElementById('manageTournament:dateTo_input').value;
/*var compNameVal = document.getElementById('manageTournament:title_input').value;*/

var isValidName = validateFieldsInOtherTournament('manageTournament', ['title'], lang);
if (isValidName) {
if (validRuContentT) {
var filledBothDate = (dateFromVal != "" &amp;&amp; dateToVal != "");
var isEmptySeason = ("" != String(seasonVal));
if ( filledBothDate || isEmptySeason) {
return wizard.next();
}
}
}
return "competitionId"; // currentTab
}

我使用代码js wizard 。但还是不行。(

//已更新

I try to do something like this

function validateManageOtherTournaments(wizard, validationTab, lang) {
/*var wizardElement = document.getElementById('wiz');*/

var currentTabId = validationTab;
if (currentTabId != 'competitionId') {
var currentStepIndex = wizard.getStepIndex(wizard.getState().currentStep),
stepIndexToGo = currentStepIndex + 1;
var stepIdToGo = wizard.cfg.steps[stepIndexToGo];
return wizard.loadStep(stepIdToGo, stepIndexToGo, false); // next
}

var seasonVal = document.getElementById('manageTournament:name_season_input').value;
var dateFromVal = document.getElementById('manageTournament:dateFrom_input').value;
var dateToVal = document.getElementById('manageTournament:dateTo_input').value;
/*var compNameVal = document.getElementById('manageTournament:title_input').value;*/

var isValidName = validateFieldsInOtherTournament('manageTournament', ['title'], lang);
if (isValidName) {
if (validRuContentT) {
var filledBothDate = (dateFromVal != "" &amp;&amp; dateToVal != "");
var isEmptySeason = ("" != String(seasonVal));
if ( filledBothDate || isEmptySeason) {
var currentStepIndex = wizard.getStepIndex(wizard.getState().currentStep),
stepIndexToGo = currentStepIndex + 1;
var stepIdToGo = wizard.cfg.steps[stepIndexToGo];
return wizard.loadStep(stepIdToGo, stepIndexToGo, false); // next
}
}
}
var currentStepIndex = wizard.getStepIndex(this.getState().currentStep),
stepIndexToGo = currentStepIndex;
var stepIdToGo = wizard.cfg.steps[stepIndexToGo];
return wizard.loadStep(stepIdToGo, stepIndexToGo, false); //competitionId
}

如何返回向导的下一个功能选项卡?

最佳答案

我做了这样的事情:

public String onFlowProcess(FlowEvent event)
{
if (!event.getOldStep().equals("competitionId"))
{
return event.getNewStep();
}
if (validationPassed())
{
return event.getNewStep();
}
else
{
return event.getOldStep();
}
}

private boolean validationPassed()
{
// do your validation here.
// return true if validation passed
}

然后在我的向导中:flowListener="#{myBean.onFlowProcess}"

关于java - Primefaces 向导。如何返回onnext的js函数选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14772926/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com