Plotly - prevent <a> Tag from open new tab - anchor

The x label of my plotly diagram contains a link to the selected data point:
let str = '<a href="' + url + '"target=' + '_self' + '>' + cycleStart[1] + '</a>';
But the link is always opened in a new tab. I know that the target attribute causes this problem. But as you can see my simple solution is not working. I already searched
target="_blank"
in the plotly.min js file and changed it into
target="_self"
Also this does not work for me.
So how can I prevent this Tag from opening a new tab? I want the url to open in the same window.

Related

Bootstrap Tokenfield does not work in mobile Safari/iOS 8

I am using bootstrap tokenfield to instrument my email textbox to support multiple email input.
User types letter a in the email textbox (the one with red font in the picture) . A list of matched emails show up in a selection menu (the box that shows the email abc#gmail.com in black)
After the user clicks and selected an email, the selected value is not captured. At the end I only got a letter a in the email textbox
How can I fix this issue?
It turns out I am also using Fastclick in my project. It swallowed the click event of the selection menu (of css class tt-selectable) used by bootstrap-tokenfield
At the end it is my solution. Fork the twitter typeahead.js project and change the following line from
$el = $(that.templates.suggestion(context)).data(keys.obj, suggestion).data(keys.val,
that.displayFn(suggestion)).addClass(that.classes.suggestion + " "
+ that.classes.selectable);
to
$el = $(that.templates.suggestion(context)).data(keys.obj, suggestion).data(keys.val,
that.displayFn(suggestion)).addClass(that.classes.suggestion + " "
+ that.classes.selectable + " needsclick");
The additional css class needsclick will disable fastclick on this elements

JSF2.0 Primefaces automatically redirects instead of forwarding

I'm trying to create a website using PrimeFaces and NetBeans,
I'm using the DefaultMenuItem class to dynamically create the menu but when I use either setUrl or setOutcome the site redirects instead of forwarding.
Here's a piece of my code
DefaultMenuItem item = new DefaultMenuItem(obEvet.getcEvent());
item.setUrl(obEveto.getcName());
System.out.println("MenuView:" + obEvet.getcName() + " " + obEvet.getcModule() + " " + obEvet.getcEvent());
item.setAjax(false);
firstSubmenu.addElement(item);
The menu is configured in two parts, the first one loads the companies, the second one loads the available modules depending on what company I selected.
Please note that this problem only happens when I click any of the elements of the second list.

Twitter Share Link Will Only Show First Word Of Topic Title

hi guys basically I have something called $content[topic] which in php would show the topic which could be something like "Platformers What Are They"
but when a user would click on my share button for twitter it will only show "PLATFORMERS [The LINK]" and not the whole title that I wanted showing, how do I correct this?
here is the code for the share button I am using
<a href=https://twitter.com/intent/tweet?url=http://www.sentuamessage.com/blog.php?who=$content[id]&text=$content[topic]&hashtags=blogs,SentUAMessage target=new>Image Here</a>
any ideas?
You need to URLencode all your variables.
In your case, do something like....
$URL = "https://twitter.com/intent/tweet?"
+ "url=" + urlencode("http://www.sentuamessage.com/blog.php?")
+ "&who=" + urlencode($content[id])
+ "&text=" + urlencode($content[topic])
+ "&hashtags=" + urlencode("blogs,SentUAMessage");
Basically, make sure everything is properly encoded.

Info Window URL needs to be prefixed with http NOT the default https

I am using the following code in the fusion tables 'customize info window' to create hyperlinked URL's from a column in my table:
"{URL}"
This works fine in returning the clickable hyperlink in the info box except fusion maps by default tacks on https: instead of http: when the link is clicked. This causes problems when the user clicks the hyperlink and it tries to take them to a secure site when in fact it is not secure. The browsers throw up all sorts of warnings that will scare the pants off a lot of users who don't know what is happening.
Does anybody know how to remedy this and have the default be http and not the current https?
Thanks, Shep
You may want to abandon the "{URL}" approach and display the hyperlink with some simple HTML. This example from Google shows how to modify the info window's HTML in Javascript:
google.maps.event.addListener(layer, 'click', function(e) {
// Change the content of the InfoWindow
e.infoWindowHtml = e.row['Store Name'].value + "<br>";
// If the delivery == yes, add content to the window
if (e.row['delivery'].value == 'yes') {
e.infoWindowHtml += "Delivers!";
}
});
Changing the e.row['Store Name'] to your URL column name (maybe, e.row['URL']) and surrounding by a couple of hyperlink tags <a> should do the trick:
e.infoWindowHtml = "<a href='" + e.row['URL'].value + "'>Click here!</a>";
There are three ways:
Specify a full URL including protocol in your data
Use Link here in a custom info window layout
Completely override the content as in the answer above
I would recommend #1 because you can choose the right protocol for every link. However #2 is probably easier in that you can leave your data the way it is.

Remove Blank Entry on DropDownList in MVC

I have been looking but couldn't find any way to remove the blank item on my dropdown list. Ideally, I would like to do this without altering the model. I just want to remove the blank item from the dropdown list so that users are forced to select one (so they can't select "blank").
Note: I am using the default dropdown list that comes with the MVC framework.
Here is my code:
' controller action:
ViewBag.CompanyId = New SelectList(db.Companies, "CompanyId", "Name")
' view:
#Html.DropDownList("CompanyId", String.Empty)
#Html.ValidationMessageFor(Function(model) model.CompanyId)
How are you building the options for your dropdown?
I never have blank options.
I usually create my dropdown like this:
#Html.DropDownListFor(x=>x.Client, new SelectList(Model.Clients))
Obviously your model options will be different.
Answer: Remove String.Empty
Update on 2021: My problem was on the JS script side, I was appending an empty line within my dropdown :D
Like this:
$("#" + "YourID").append('<option></option>'); //Remove This Line
for (var i = 0; i < CountriesList.length; i++)
{
$("#" + "YourID").append('<option value="' + CountriesList[i] + '">' + CountriesList[i] + '</option>');
}
Removing the first line will get you directly the first element from your Items list :)
Happy coding everyone.

Resources