Recent searches
No recent searches
Can't See a New Form Under "Submit a Request"
Posted Jul 13, 2023
We have a Help Center theme that hides one form (Form A) from all users except members of one organization (Group A). This code has been working as expected since May of last year.
We have been asked to add a new form and organization. Along with new visibility rules for them. We'll call ne new form and group, Form B and Group B.
Form A (360003482932) must be visible to Group A and Group B. But Form B (14992348743700) must only be visible to Group B.
The code on the live Help Center theme is as follows.
document.addEventListener('DOMContentLoaded', function() {
// Key map
var Redacted;
var Redacted;
var Redacted;
var Redacted;
var Redacted;
var Redacted;
var i = 0;
var checkExist = setInterval(function() {
i++;
if ($("a.nesty-input").length){
clearInterval(checkExist);
$("a.nesty-input").each(function() {
$(this).bind( "click", function() {
for (var c in HelpCenter.user.organizations) {
if (HelpCenter.user.organizations[c].name === "Group A"){
$("#360003482932").show();
}
else{$("#360003482932").hide()}
//reserve space for additional organizations
The code in the test theme is as follows.
document.addEventListener('DOMContentLoaded', function() {
// Key map
var ENTER = 13;
var ESCAPE = 27;
var SPACE = 32;
var UP = 38;
var DOWN = 40;
var TAB = 9;
var i = 0;
var checkExist = setInterval(function() {
i++;
if ($("a.nesty-input").length){
clearInterval(checkExist);
$("a.nesty-input").each(function() {
$(this).bind( "click", function() {
for (var c in HelpCenter.user.organizations) {
if (HelpCenter.user.organizations[c].name === "Group A" || HelpCenter.user.organizations[c].name === "Group B"){
$("#360003482932").show();
}
else{$("#360003482932").hide()}
if (HelpCenter.user.organizations[c].name === "Group B"){
$("#14992348743700").show();
}
else{$("#14992348743700").hide()}
//reserve space for additional organizations
The thing that has me confused is that members of both Group A and Group B can see Form A. So, the code is recognizing the new organization, and treating Form A correctly.
But Form B is not visible regardless of organization membership. So, why is Form A being displayed correctly while Form B is not?
2
3 comments
Damon Maranya
I tried converting the JQuerry to JScript using ChatGPT (sure it hallucinates, but it's a pretty good code monkey). Just on the off chance that it's a library thing. But the behavior remains the same.
I can't figure out why the IF block that worked for the original code and is working in the new code with the additional organization. Isn't working for the second form.
I ran the Form A old IF block and the new Form B IF block through text comparison and the only things that are different are the organization name and the form ID.
But they should be different and shouldn't affect how the code runs. As long as the form number and organization names are correct, which they are. I copied and pasted the form ID for the new form out of the URL of the Form B edit page, just to make sure that it was correct.
I even ran the end of the URL and the form ID from the code through a text compare just to make sure I wasn't wearing my crazy pants by accident or something.
Does anyone have any idea why these two code blocks are behaving differently?
The new JScript version of the code if anyone is interested.
0
Damon Maranya
Well, I just tried it one more time. But this time I refreshed all of the open Zendesk pages, and now it's working in preview.
I have no idea why it wasn't working before. But I feel like there's an old saying about gifts and horses' mouths that applies here.
0
Brett Bowser
Glad you were able to get this resolved Damon! Appreciate you sharing your solution with everyone :)
0