Recent searches


No recent searches

Isak Viste's Avatar

Isak Viste

Joined Aug 16, 2022

·

Last activity Feb 08, 2024

Following

0

Followers

0

Total activity

15

Votes

8

Subscriptions

4

ACTIVITY OVERVIEW

Latest activity by Isak Viste

Isak Viste commented,

Community comment Q&A - Help center and community

Thank you Brandon, I appreciate you taking the time to write such a thorough detailed response! 
Unfortunately, none of the tricks seems to work in my case.

The issue, as far as I can tell, is that Zendesk uses some trick to hide the select field behind an element with a lot of js to make it work and look like a select field. Hence when I change the select field through code, it is not the same way as if a user interacted with it.

If I show the select field using a display = "", I can see that select field is right under the other field and looks correct:
But I can't figure out how to update the
nesty-input field that is above the select field.

I have tried to remove the nesty-input field and just show the select field, but that breaks Zendesks submit form code that relies on that field for it's logic. This also explains why I had some weird cases I mentioned previously, as its role is not only visually, but also influences what form is being submitted (instead of the select field which I thought was the decider).

I've tried redrawing both the hidden select field, and the nesty-input a element but neither works. I cannot just change the inner html of the nesty-input a element either, as though it will then look correct, programmatically it is not. It keeps the selected form/index in code somewhere hidden.
This is all from trying and debugging in the console, and the little I could understand from the obfuscated code in the "hc_enduser-xxxx.js" file

Any thoughts on the matter?

View comment · Edited Jan 19, 2024 · Isak Viste

0

Followers

0

Votes

0

Comments


Isak Viste created a post,

Post Q&A - Help center and community

Purpose

  • Show an alert telling the user they need to be logged in when selecting certain form types in the request type drop-down
  • Redirect them to the login page if they click accept in the alert dialog
  • Stay on the same page and change nothing if they decline

Progress

  • Show alert to the user when they select one of the specific form types while being anonymous/not logged in
  • Don't redirect to the request form url when the alert shows
  • Redirect to the login page when they accept the alert

Problems

  • When the cancel the alert, they are still on the same page, but the drop-down value is showing the wrong value
    • If they had no form selected, the drop-down looks wrong and behaves weirdly
    • If they had another form selected, the drop-down looks wrong, and while everything else looks the same, if the user tries to send in the form, it fails. It fails, because the form thinks it's the new form but the user only filled in the fields shown on the screen, which is of the original form.
  • Can't figure out how to change the drop-down value back to the original value through code. None of the standard way of doing this through JavaScript is working.

Example Code

This being a stripped down version of my code, most of this works fine, everything except the line 31: "dropdown.value = previousForm;"
Which I also have issues with just doing in the console; any tries to modify the selected drop-down value through code, will not do anything. Trying to see the value of the select element in the console correctly shows what I'm setting through code, but what the user sees is completely different/wrong.

Example Images

Image 1

After selecting "I want to report a bug or crash" while not having any form selected, and then declining the alert dialog that shows up, I end up in this state

See console that everything looks as it should, but the drop-down is behaving weirdly

Image 2

Moreover, if I then open the drop-down, the "I want to report a bug or crash" is highlighted in bold, and selecting it will not do anything. However, selecting "-" which is what I was on, and should currently be on, refreshes the page, most likely meaning the drop-down back-end believes I am on the "I want to report a bug or crash" form. (Which clearly I am not as no fields are showing, and I haven't been redirected)

Conclusion

I'm having an awful time trying to do any kind of manipulation of drop-downs in themes, and I'm at my wits end.
This is on the latest version of the official Copenhagen theme version 3.1.6, with very minimal modifications, only adding custom JavaScript alongside the existing JavaScript.

Any and all help is greatly appreciated!

Edited Jan 16, 2024 · Isak Viste

0

Followers

2

Votes

3

Comments


Isak Viste commented,

Community comment Feedback - Chat and Messaging (Chat)

can you share some examples of what types of answers need to be reused?

An example would be a Present Options followed by a Transfer to Agent
I don't want to have to configure the transfer to agent fields for all the different flow if I decide to add a new field, so only being able to change it one place and all other flows call this specific flow would be very helpful!

View comment · Posted Aug 16, 2022 · Isak Viste

0

Followers

1

Vote

0

Comments