我使用jquery步骤作为表单向导,我需要在表单向导中实现primefaces的自动完成,但是当我将自动完成从表单中删除时,自动完成在向导表单中不起作用,它有效,这是我使用的代码
<h:form id="accomplishment-form" styleClass="wizard-big">
***********************some code*****************************************
<p:autoComplete disabled="#{(awardActivity.award.awardProof != null or awardActivity.award.awardProof != '') and (awardActivity.award.certificationApproved==0 or awardActivity.award.certificationApproved==1)}" value="#{awardActivity.award.country.name}" forceSelection="false"
completeMethod="#{candidateController.autocompleteResidence}"
placeholder="Search Country">
<p:ajax update="accomplishment-form" event="itemSelect" process="@this"></p:ajax>
</p:autoComplete>
********************some code********************************
</h:form>
这是jquery步骤向导
$(document).ready(function(){
$("#wizard").steps();
$("#accomplishment-form").steps({
bodyTag: "fieldset",
onStepChanging: function (event, currentIndex, newIndex)
{
// Always allow going backward even if the current step contains invalid fields!
if (currentIndex > newIndex)
{
return true;
}
// Forbid suppressing "Warning" step if the user is to young
if (newIndex === 3 && Number($("#age").val()) < 18)
{
return false;
}
var form = $(this);
// Clean up if user went backward before
if (currentIndex < newIndex)
{
// To remove error styles
$(".body:eq(" + newIndex + ") label.error", form).remove();
$(".body:eq(" + newIndex + ") .error", form).removeClass("error");
}
// Disable validation on fields that are disabled or hidden.
form.validate().settings.ignore = ":disabled,:hidden";
// Start validation; Prevent going forward if false
return form.valid();
},
onStepChanged: function (event, currentIndex, priorIndex)
{
// Suppress (skip) "Warning" step if the user is old enough.
if (currentIndex === 2 && Number($("#age").val()) >= 18)
{
$(this).steps("next");
}
// Suppress (skip) "Warning" step if the user is old enough and wants to the previous step.
if (currentIndex === 2 && priorIndex === 3)
{
$(this).steps("previous");
}
},
onFinishing: function (event, currentIndex)
{
var form = $(this);
// Disable validation on fields that are disabled.
// At this point it's recommended to do an overall check (mean ignoring only disabled fields)
form.validate().settings.ignore = ":disabled";
// Start validation; Prevent form submission if false
return form.valid();
},
onFinished: function (event, currentIndex)
{
var form = $(this);
// Submit form input
form.submit();
}
}).validate({
errorPlacement: function (error, element)
{
element.before(error);
},
rules: {
confirm: {
equalTo: "#password"
}
}
});
});