using chosen as jquery select but its loading all values - javascript

i am using jquery chosen plugin and it is working fine, the issue is i had two tabs ui query based which loads the jquery chosen with multiselect for both, the name of both selects are different
but in one case, i select a value and run it and open it , keeps the value and run again works fine,
when i go to the other tab, run the code and chose one value in that jquery chosen, its works first time, but next time i open same tab and it loads all the values in that jquery chosen.
what i am missing here, do i need to do a destry, but if destroy it will not keep the values.
bit lost and confused

Related

How to open multiple modal in Angular?

I use mat-dialog in a a project and there is a form field (dropdown) called course in this dialog. I want to open another dialog in order to add a course record that is not available in the course list dropdown. At this step, I am wondering what is a proper way for this scenario.
Should I open the second dialog inside the first dialog by setting the form fields of the second one?
Or is it better just hiding first dialog and showing second and then after completing the operation on the second, close second ad show first one?
If there is a demo of a proper approach for opening dialog on another I would be appreciated.
It depends on your preference, requirement and the library you have chosen. Since you have already mentioned that you are using material dialog, it works fine with nested unlike bootstrap-modal. So, If I were you, I would go with nested modal by properly configuring z index and backdrop.
You can check this demo just to get idea,

Trigger dynamic dropdown to load

I'm very new to scripting stuff, but here's what I'm trying to do. When visiting a webpage, there are two dropdowns available, but the second is disabled until a selection is made in the first. The content of the second populates automatically as soon as something is selected in the first, and each option in the first leads to a unique set of options in the second. I'm attempting to automate selecting items in both. I can set a value in the first using "document.getElementById('firstDropdown').value = 'myValue'", and I can get the label of myValue to appear in the dropdown window, but I can't get the second dropdown to populate because it doesn't realize that I've made a selection since I'm not physically clicking on something. Is there a way to reload or refresh only secondDropdown (not the entire page) so that it realizes I have made a selection for firstDropdown and thus populate?
You can trigger change event of firstDropdown with below code using the Event Constructor.
document.getElementById('firstDropdown').dispatchEvent(new Event('change'));

Showing and hiding a list box on a spawned template page in Adobe Acrobat Pro

I'm struggling here and I'm hoping I'm just missing some small detail.
In a nutshell, I have a PDF file that by default has three pages shown and five hidden template pages. A drop-down form on the first page has five options and depending on the selection one of the five template pages pops up at the end of the document (as page 4).
On one of those template pages is a drop-down with two choices, "High" or "Low". If "High" is selected it shows another drop-down with a few different options and a list box with multiselect enabled. The listbox populates different choices depending on that second drop-down's selection. If "Low" is selected the drop-down and list box are hidden and four checkboxes are unhidden.
All of this works perfectly on the actual template pages, I don't have the exact code with me as of right now (as it's at my work )of the High/Low drop-down, but the code is set as a simple if/else if/else on the drop-down to display.visible/hidden based off of the selection.
The issue I'm running into is that I can not get the listbox to hide when the template pages is hidden and the 4th page is spawned. I have updated the JavaScript to Acrobat's p4.PageName.FormItem format and I've tripple checked my JavaScript and I can't see any errors. Everything else will toggle hidden/visible without an issue, but just not the listbox... If I'm on the template page and I delete and readd the exact same JavaScript it works, but as soon as I spawn a different page and then respawn that one it goes back to not working (which makes sense).
So... What in the world am I doing wrong, or how exactly do I go about fixing this?
I just wanted to provide an answer to my own question, as I was able to finally figure this out. The issue was a simple one, the person that originally made the pdf had a JavaScript code that, for some reason I still don't fully understand, made sure the list box and a few other form fields were always set to visible. Once I removed that everything worked like a charm. Should have probably looked into that first!

MVC Razor ListBoxFor customize/restrict selections

I have a ListBoxFor and the first item is All Values. I already have the list box set to allow multiple selections. I would prefer to make it so that if a user selects the All Values option they are either asked if they want to clear out all other selections (Use All Values) or keep their current selections (De-select All Values). I would be ok without the user dialog asking them what to do and just automatically clearing out selections, but that is less preferable.
At first glance it seems that Javascript/jQuery is the best route to go about for this. I wanted to check to see if anyone knew of built in functionality for ListBoxFor that does this. The other option that I see is building a custom html extension. Even with this I still only see JS/jQuery being built and auto generated.

Chosen Java script plug in behavior - Shows items in list prematurely

We are using Chosen Javascript plugin http://harvesthq.github.io/chosen/ . It works great except one issue. When it loads on the page, it shows the "list box" kind of view for few split seconds in place of the Chosen plug in. It loads to the chosen plug in "view" finally. But for that few moments it looks bad with all the data showing as items in list box. For example, if we have a Chosen Plug in control linked to a list of States in US. When this page loads, for a split second, it shows a list box (not the chosen plug in) and it shows all the items in the list (list of states etc) .. then after the page loads completely, it will render the Chosen Plug in with blank items as its supposed to.
Is there any setting I can make use of to fix this? Any work arounds? Causes? Any one encounter this before? Thanks for the help.
You could potentially set the style display:none; on the element and then display it once chosen loads.

Categories

Resources