0

私はPrimefaces 3.5を使用しています。の onnext ハンドラで js 関数を呼び出してみてください<p:wizard/>。検証結果が現在のタブになった後、特定のタブのタブに次の戻りが必要です。私の検証機能

    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 ウィザードを使用します。しかし、それでもうまくいきません。(

//更新しました

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
            }

ウィザードの onnext 関数タブに戻るにはどうすればよいですか?

4

1 に答える 1

1

私はこのようなことをしました:

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}"

于 2013-02-08T14:06:00.787 に答える