Hello,
In Power Pages, based on dropdown value the user selects, I want to redirect user to the relevant page, it could be 5 other pages
I have 25 basic forms, I am passing the id parameter from one to another
Dropdown value has values 1, 2, 3, 4, 5 - I am not sure where to specify go to to an HTTPS page, if value == 1, then go to https: url1, if value ==2, then go to url2
Code below hides/shows field based on user selection
$(document).ready(function () {
$("#querytype").change(onDisplaySectionChange);
onDisplaySectionChange();
});
function onDisplaySectionChange() {
var varQuery = $('#querytype').find("option:selected").text();
if (varQuery === "1" || varQuery === "2"){
$('#querytype').parent().parent().hide();
$('#fieldtohide').parent().parent().hide();
}
else {
$('#fieldtohide).parent().parent().show();
}
}
Code below has a 'Previous' page button
$(document).ready(function () {
$("#EntityFormPanel").eq(0).append("<button type='button' id='btnReturn' class='btn' style='color:#fff;background-color:#0B7F99;border-color:36f;' onclick='exitApplication()'>Previous</button><br><br>");
});
function exitApplication() {
var prevurl = "{{ request.url | base }}{{ page.parent.url }}?id={{request.params['id']}}&relid={{request.params['relid']}}";
window.open(prevurl, "_self");
}
Below I try to insert the 'go to a different page, but it then throws an error in the next basic form, saying we can't find the form', and it depends what code I add, it doesn't remember the previous page and it goes back to the main page
$(document).ready(function () {
$("#querytype").change(onDisplaySectionChange);
onDisplaySectionChange();
});
function onDisplaySectionChange() {
var varQuery = $('#querytype').find("option:selected").text();
if (varQuery === "1" || varQuery === "2"){
$('#queryytype').parent().parent().hide();
$('#fieldtohide').parent().parent().hide();
}
else {
$('#fieldtohide).parent().parent().show();
}
}
$(document).ready(function () {
$("#EntityFormPanel").eq(0).append("<button type='button' id='btnReturn' class='btn' style='color:#fff;background-color:#0B7F99;border-color:36f;' onclick='exitApplication()'>Previous</button><br><br>");
});
function exitApplication() {
var prevurl = "{{ request.url | base }}{{ page.parent.url }}?id={{request.params['id']}}&relid={{request.params['relid']}}";
window.open(prevurl, "_self");
}
How can I redirect user to the correct page, and where would I place the code, is in the Javascript basic form, or in the 'submit' button?
How can I ensure that it remembers the previous page properly?
Thank you