Recent searches
No recent searches

Damon Maranya
Joined Jan 20, 2022
·
Last activity Dec 29, 2023
Following
0
Followers
0
Total activity
37
Votes
6
Subscriptions
5
ACTIVITY OVERVIEW
BADGES
ARTICLES
POSTS
COMMUNITY COMMENTS
ARTICLE COMMENTS
ACTIVITY OVERVIEW
Latest activity by Damon Maranya
Damon Maranya commented,
Unfortunately, I am not really that good with JScript. I mostly cobbled this together from bits and pieces I found around the web with a few tips from users on this form.
But I do see one difference between the two code sets that might be the culprit. I can't say for sure because I'm still very much a cargo-cult coder.
I noticed that the form ID in the code we are running does not include the curly brackets that your code does.
So, in our code a line containing the ID looks like this;
else{$("#360003482932").hide()}
Whereas in your code the same line looks like this;
else{$("#{360003482932}").hide()}
I don't know enough to say that it's wrong. It's just the only difference I've been able to spot between the two sets so far.
Edit - I just asked ChatGPT (it's my coding buddy) and it said the following.
"This code includes a syntax error. The expression "#{360003482932}"
inside the selector doesn't make sense in this context, as the #
symbol is used to reference an id in a jQuery selector, and the braces ({}
) and the numeric value inside them do not form a valid id or expression in this context."
View comment · Edited Aug 11, 2023 · Damon Maranya
0
Followers
0
Votes
0
Comments
Damon Maranya commented,
Hi Max,
I know that Sparkly insists that their code is working on multiple platforms. But no one on this thread seems to be able to make it work.
What I did finally get to work is the code you see below, inserted at the top of the script.js file. You can find the code block of it in this thread just above your post.
View comment · Edited Aug 10, 2023 · Damon Maranya
0
Followers
0
Votes
0
Comments
Damon Maranya commented,
Hi Lea. The image of your code is pretty small, so I can't really read it (old eyes). But I can tell you that the solution we got to work was using the code below at the top of the scripts.js file. Just after the section establishing the "var" set.
Try moving your code to the top of the script and see what happens. Also, if you post your code as a code block. The community can take a look at it, and give you feedback if there's an issue there.
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 === "Managers"){
$("#{FORMID}").show();
}
else{$("#{FORMID}").hide()}
View comment · Posted Aug 07, 2023 · Damon Maranya
0
Followers
0
Votes
0
Comments
Damon Maranya commented,
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.
View comment · Edited Jul 14, 2023 · Damon Maranya
0
Followers
0
Votes
0
Comments
Damon Maranya commented,
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.
var i = 0;
var checkExist = setInterval(function() {
i++;
var elements = document.querySelectorAll("a.nesty-input");
if (elements.length) {
clearInterval(checkExist);
Array.prototype.forEach.call(elements, function(element) {
element.addEventListener('click', function() {
for (var c in HelpCenter.user.organizations) {
if (HelpCenter.user.organizations[c].name === "Managers" || HelpCenter.user.organizations[c].name === "HR") {
document.getElementById("360003482932").style.display = 'block';
} else {
document.getElementById("360003482932").style.display = 'none';
}
if (HelpCenter.user.organizations[c].name === "HR"){
document.getElementById("14992348743700").style.display = 'block';
} else {
document.getElementById("14992348743700").style.display = 'none';
}
}
});
});
}
}, 100); //assuming the interval is 100 milliseconds
View comment · Posted Jul 14, 2023 · Damon Maranya
0
Followers
0
Votes
0
Comments
Damon Maranya created a post,
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?
Edited Jul 14, 2023 · Damon Maranya
2
Followers
2
Votes
3
Comments
Damon Maranya commented,
Hi Jean,
This thread will be just fine to discuss the issue.
As far as I can tell the code itself is correct, as part of it is already working as expected. However, another part of it, using exactly the same structure, doesn't seem to be applying at all. Which makes me think that the new form's ID needs to be added to style.css or one of the HBS template files in the theme.
Does the new form ID have to be added to any other resources before the code in Script.js can recognize it?
View comment · Edited May 31, 2023 · Damon Maranya
0
Followers
0
Votes
0
Comments
Damon Maranya created a post,
Hi Everybody!
I have a Help Center theme that was edited some time ago to hide one specific form from all users, except the members of a specified organization and has been working fine ever since.
But things evolve and we now need to hide two forms. One from all but one organization and one from all but two organizations. However, the new code I have in place isn't working correctly and I'm not really sure why. But I'm a real novice with HTML so that's not really all that surprising.
When the new code is added to a test template and the preview is run. It does not change the visible forms and appears to still be using the code that is currently in the live theme.
I have also swapped the live theme after hours to confirm that it was not a buggy preview feature. But the behavior was consistent.
The new form is not visible despite the account used for testing being an administrator and in the correct organization. While the old form was still visible despite the test account not being in the required organization.
Below is the code that the live site is using.
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 === "Managers"){
$("#360003482932").show();
}
else{$("#360003482932").hide()}
And here is the new code that replaced it.
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 === "Managers" || HelpCenter.user.organizations[c].name === "HR"){
$("#360003482932").show();
}
else{$("#360003482932").hide()}
if (HelpCenter.user.organizations[c].name === "HR"){
$("#4992348743700").show();
}
else{$("#4992348743700").hide()}
As you can see the changes are not very significant. Does anyone have any idea why the HC would still be producing the same behavior now as before the change?
Posted May 17, 2023 · Damon Maranya
0
Followers
4
Votes
5
Comments
Damon Maranya commented,
Add my vote to this feature as well.
In my case my company wants to build a form for employee terminations. But due to the nature of our business some terminations must happen after a specific time on the designated day.
Currently this is only doable with a calendar field for the day, month, and year. Plus, a separate text field immediately before or after named something like "Do not disable before this time" which is not nearly as convenient for the requester or the agent working on the issue.
At this point even just a dedicated time field type would be better than what we currently have.
View comment · Posted Apr 21, 2023 · Damon Maranya
0
Followers
1
Vote
0
Comments
Damon Maranya commented,
I never told you to do anything. I told you what we are doing, and I asked if there was a reason that you needed anonymous users to submit a ticket.
So, I'm not really sure what you mean by "You're incorrect...". There isn't anything to be correct or incorrect about in my reply.
View comment · Posted Feb 17, 2023 · Damon Maranya
0
Followers
0
Votes
0
Comments