Good afternoon,
I'm trying to find a way to programmatically set the content id for the next step in a wizard based on a radiogroup choice on the previous step.
I'm basing it on the Accepted answer from Mihaela on this post:
https://www.telerik.com/forums/skipping-diabled-steps-in-wizard-doasn-t-work
Incidentally, the required validation on the radiogroup in the example doesn't seem to work - you can click next to step 2 without choosing an option.
Rather than disable steps and jump to a different next step, I'd like to set the content for the next step based on the selected option.
On the select event for the wizard form I've tried the following:
var wizard = e.sender;
var radioValue = $("input[name='uploadType']:checked").val();
if (radioValue == "1") {
//e.sender.insertAt(3, { title: "Upload File(s)", contentId: "uploadFile" });
wizard.steps()[3].contentId = "uploadFile";
}
else {
//e.sender.insertAt(3, { title: "Choose File(s)", contentId: "chooseFile" });
wizard.steps()[3].contentId = "chooseFile";
}
e.preventDefault();
wizard.select(3);
I've used the syntax from this question:
https://www.telerik.com/forums/programmatically-enable-or-disable-wizard-buttons
$("#wizard").data("kendoWizard").steps()[1].buttons()[1].enable(true);
This assumes that e.sender on the wizard select event is the equivalent of $("#wizard").data("kendoWizard").
I have two templates with partial views which are used dependent on the radiogroup selected value:
<script type="text/x-kendo-template" id="uploadFile">
@await Html.PartialAsync("_UploadFile")
</script>
<script type="text/x-kendo-template" id="chooseFile">
@await Html.PartialAsync("_UploadChoose")
</script>
The insertAt method works by inserting a step with the desired content, but I don't want to insert multiple new steps.
Can what I want to do be achieved? Can the content be set programmatically?
I did also wonder if it was possible to have the conditional logic (e.g. if (radiogroup value == 1) in the kendo template, but this also didn't seem to work.
Kind regards,
Richard