How to disable the ticket form dropdown?

已回答


已于 2018年10月01日 发布

Does anyone have some custom javascript that would allow me to disable the dropdown for form submission when someone lands on a specific form? I've tried everything but it seems like the from request drop down doesn't behave like a normal drop down.
I want this to be un-selectable when a user lands on a certain form. There a few hidden forms we send users to from time to time but if they click on the drop down, they can navigate out of that form and not be able to get back. Any help would be extremely appreciated!


0

38

38 条评论

Hey David,

Use the given code: For script.js file

 

$(document).ready(function() {
$('#request_issue_type_select option[value="000000"]').remove();
  $('.nesty-panel').on('DOMNodeInserted', function(e){
    $(this).children('ul').children().remove('#000000');
  });
});




Note: remove '000000' and add your form ID which you want to eliminate from the dropdown.

 

 

Make sure, document_head.hbs file must have CDN of jquery:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

 

Thanks

 

 

0


Hey guys. 

So, I'm really in need of your help. 

I'm also trying to eliminate the ability to choose between forms, and I can't seem to place things correctly. 

Used this: 

document.addEventListener("DOMContentLoaded", function() {
// Remove the forms from the drop-down selector
  document.querySelector('.nesty-panel').addEventListener('DOMNodeInserted', function(event) {
 
event.target.querySelector('li[id="your_form_id"]').remove();

//repeat above line for any other forms

  });
});

And this: 

if ($("#request_issue_type_select").val() == "ticketformIDhere) {
$(".request_ticket_form_id").hide();
};

All under script.js, but still I can choose between them. 

HELP!

0


Awesome!

0


Awesome. That worked.

0


Hi,

See the issue, you will have. to add jQuery CDN on document_head.hbs file.



Add the CDN:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

 

See the below screenshot:

 

Thanks

Ifra

 

 

1


Okay, can you share the URL of your public theme so I can figure out the issue?

0


Thanks, 367066863047 - I tried adding that code to the theme's script.js file as you recommended but the drop-down menu still appears for some reason:

0


Hi pstrauss.

Just copy the below code and paste it into your script.js file under the DOM function.

if ($("#request_issue_type_select").val() == "1900000215705") {
var dropDown = document.querySelector('.request_ticket_form_id');
dropDown.style.display = "none";
};

 

Screenshot for the same:

If any query, let me know :)

Thank You

 

Team Diziana

1


27941396527 in your help-center, go to your theming, customize, edit code (bottom)

access your script.js function and plop this in there.

Then submit

This will hide the form selector IF they end up on this form. You may need to reference this form via URL directly.

var form = $('#request_issue_type_select').val();
if (form == 1900000215705){
$('.form-field.request_ticket_form_id').hide()
}

In your script.js file, it should look like this.

Let me know if this works for you

0


I'm trying to hide the "please choose your issue" drop-down. I don't want the user to be able to select which form they are using.

0


请先登录再写评论。

找不到所需的内容?

新建帖子