Form Validation with Clickable Milestone Bar

I am running into an interesting problem.  But first let me provide a little context.  I am building an intake form that has 6 different screens of information that needs to be added.  It is in a wizard format.  The user after the initial step has the option of using the milestone bar to go to the different forms (except for the last form that is the review & submit form).  Here is were it gets interesting.  if the user uses the button at the bottom of the screen validation should occur for all required fields on that form and that form only.  If the user uses the milestone bar no validation occur.  When the user reaches the next to the last form, it should run a validation on all forms.

 

I have used a validation group which will use a!vsalidation message to accomplish the last part works great.  The problem I am having is doing validation on each of the forms independently.  Right now, if I add validation to the button that is used to go to the next screen it will validate all of the forms.  I am using the same button to advance from one form to the next until we get to the next to last form.

 

Here is the code for my button layout

a!buttonLayout(
primaryButtons: {

Save & Finish Later Button - no problem
a!buttonWidgetSubmit(
label: "Save & Finish Later",
saveInto: {
ri!btnValue,
a!save(
ri!stepValue,
local!step
)
},
showWhen: and(
local!step > 1,
local!step < 7
),
style: "SECONDARY",
skipValidation: true()
),

Jump to last form button - no problem since this will run the validation
a!buttonWidget(
label: "Jump to Review & Submit",
saveInto: {
a!save(
ri!btnValue,
"jump"
),
a!save(
local!step,
7
)
},
showWhen: local!step = 5,
style: "PRIMARY",
submit: false(),
validate: true(),
validationGroup: "submit"
),

- problem button
a!buttonWidget(
label: "Enter " & index(
cons!SW_MILESTONE_VALUES_FOR_SUBMISSION_FORM,
local!step + 1
),
saveInto: {
a!save(
ri!btnValue,
"next"
),
a!save(
local!step,
if(
local!step = 7,
7,
local!step + 1
)
),
a!save(
ri!stepValue,
local!step
)
},
showWhen: local!step <> 7,
style: "PRIMARY",
disabled: or(
rule!COMMON_checkIsNullOrEmpty(
ri!SW_sweepstakes_CDT.promoName
),
if(
local!formType = "search",
rule!COMMON_checkIsNullOrEmptyNumber(
ri!selectedValue
),
false()
)
),
validate: true()
),

Final button for submission - no problem
a!buttonWidgetSubmit(
label: "Submit",
saveInto: {
a!save(
ri!stepValue,
7
),
a!save(
ri!btnValue,
"submit"
)
},
showWhen: local!step = 7,
style: "PRIMARY",
disabled: if(
rule!COMMON_checkIsNullOrEmpty(
rule!SW_missingFieldFetchForValidation(
SW_sweepstakes_CDT: ri!SW_sweepstakes_CDT,
SW_prizes_CDT: ri!SW_prizes_CDT,
selectedValue: ri!selectedValue
)
),
false(),
true()
),
validationGroup: "submit"
)

 

Any thoughts or ideas would be greatly appreciated.

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data