django-autocomplete-light how to copy multi select fields - django-autocomplete-light

I'm using django-autocomplete-light with django 1.8.
I want to be able to copy the selected contents from one autocomplete field into another which requires overriding javascript code.
I tried duplicating the html content inside the autocomplete tool into another one in the browser debugger which looked good but when I click the save button in the admin page, it ignores my copied value.
Any ideas?

It works if you use an empty form for #form_template as such:
<div class = 'table' id="form_template" style="display:none">
{{ formset.empty_form }}
</div>
<div class = 'table'>
<table>
<!-- don't use #form_template in your actual form -->
From github issue

Related

DotVVM - IncludeInPage displayed for a split of second during page load

When I use IncludeInPage property of DotVVM control, this control is rendered for a split of second during page load. Include in page contains value binding and while it is not evaluted this control is displayed I guess. This is quite disturbing. How can I prevent it?
Control example:
<div IncludeInPage="{value: Gender == Gender.Male}">
This text should not be displayed at all.
</div>
Workaround: If you want to hide/show the content staticly and need to show/hide it until reload of page, use resource binding.
<div IncludeInPage="{resource: Gender == Gender.Male}">
This text should not be displayed at all.
</div>
This does not apply to situation when you want to show/hide content later dynamically.

jquery featherlight on dynamic content from DataTalbes

I am using jquery featherlight (https://github.com/noelboss/featherlight) after trying to get jquery lightbox (https://lokeshdhakar.com/projects/lightbox2/) to work. I am using DataTables to generate a list. One of the items in the table is a link to a php page that returns links. The problem is I am calling an external PHP page that generates a list of links. So my link code is like this:
<i class="fas fa-link fa-lg"></i>
The page "lenker.php" does a search and outputs html code. It looks fine in the chrome inspector. But the popup is empty. If I link to another page with the code hardcoded it shows fine. Why does it not show when it is generated on the fly? The html code looks just fine like this:
<div><a class="external" href="http://databank.artsdatabanken.no/FremmedArt2012/N63753" data-featherlight="ajax">fremmedartsvurdering 2012 for edelgran</a></div>
<div><a class="external" href="http://eol.org/pages/1033070" data-featherlight="ajax">edelgran hos Encyclopedia of Life</a></div>
<div><a class="external" href="http://linnaeus.nrm.se/flora/barr/pina/abies/abiealb.html" data-featherlight="ajax">edelgran i Virtuella floran, Sverige</a></div>
but the popup opens and then resizes to almost nothing since there is no content. Featherlight does not need any other initialization since it looks for data-featherlight="ajax".
Is the problem that datatable is dynamic content?
jQuery ajax expects one object so I solved this with enclosing my content in one DIV.

How to automate to click a button which has no ID

<div class="add" data-icon="'" ng-show="!editMode" ng-click="btnAdd()"> Add an Honor or Award </div>
Above is the html code for the button i am trying to click (Add an Honor or Award), but this button doesn't have an unique ID, and keeps on changing the xpath as the user adds multiple data.
Use css
[class='add'][ng-click='btnAdd()']
xpath is also another option
//div[contains(.,'Add an Honor or Award')]
Or,
//div[#class='add']

Expanding the use of PlaceHolderMain in Sharepoint 2010?

I want to create a 2 column layout in my master template page. I want both the left and right HTML column < div >'s in my design to have wysiwyg editors. This is what I am picturing...
<div id="container">
<div class="left-side">
<div id="sub-menu">asp:menu</div>
<asp:ContentPlaceHolder id="PlaceHolderMain1" runat="server" />
</div>
<div class="right-side">
<asp:ContentPlaceHolder id="PlaceHolderMain2" runat="server" />
</div>
</div>
but obviously, PlaceHolderMain1 or PlaceHolderMain2 are not optional content placeholders to select by default...
http://office.microsoft.com/en-us/sharepoint-designer-help/working-with-content-placeholder-controls-HA102265026.aspx
Is there a way to create an additional HTML-PlaceHolder with SharePoint?
By creating content types for a content page layout
[configure SharePoint's site settings -> then view content types under 'Site Objects' in SharePoint Designer], you could then take advantage of your "toolbox" located in SharePoint Designer.
Create your types and your page layout under site settings from your browser
Also assign your page layout to a specific master template
Open up your new page layout in SharePoint Designer
Then use the toolbox to drag any of the available content fields into your content page layout.
Save your layout page, check it in as major. Done.
As a result, I was able to drag on a Rich HTML field PLUS a web zone, into each floating div in my content page layout. FYI, you may or may not need to add on additional Tagprefix's to your content page layout, for example, if you are calling the asp:menu into it, be ready for that...
The solution also keeps you from re-creating multiple master templates, just because you need a new HTML layout scheme to choose from.

how to not execute a scriptlet code in a tab when using jquery ui tab plugin

I just came across jquery ui tabs plugin.
Its a very nice implementation but what If current code is in place.
<div id="tabs">
<ul>
<li>tab1 </li>
<li>tab2</li>
</ul>
<div id="tabs-1"><%System.out.println("test1");%></div>
<div id="tabs-2"><%System.out.println("test2");%></div>
</div>
in this case, when the page initially loads, tab1 is the default tab. However, both the sys out statements are executed initially. It does not matter what the default tab is. Ideally first sys out should execute when tab1 is selected and second when tab2 is selected.
Is there any way to avoid this? Or the only way is to have different pages for different tabs?
the scriptlet will execute because it is not restrained by javascript. If you have content in tabs-1 and tabs-2 that you do not want to execute until unless the tab is clicked then you should use the 'ajax' feature of this plugin. The demo site shows how to do this.