Select2 Not displaying properly - twitter-bootstrap-3

I have a Bootstrap Modal in which I am trying to display a select2 control. The control shows up and it works perfectly well but it doesn't display properly. I have attached a screenshot of how it is rendering as. I also copied and pasted the exact same code to a regular page and that is displaying properly. I inspected the border property as well as various other css properties but am unable to determine why it is displaying like that. Can anyone give me some pointers on how I can solve this issue?
JsFiddle showing the issue
Note: Please maximize the width of the result window to see the issue in action.
Html:
<form class="form-horizontal">
<div class="form-group">
<label class="col-sm-3 control-label">Country</label>
<div class="col-sm-6">
<select class="js-example-basic-single form-control">
<option></option>
<option>Canada</option>
<option>Mexico</option>
<option>United States</option>
</select>
</div>
</div>
</form>
Javascript:
$('.js-example-basic-single').select2({
placeholder: "Select country..."
});
EDIT:
I would also like to point out there is a dependency to the select2-bootstrap library. If I use just the select2 library, I am not witnessing this issue.

Related

Validation is Not working properly in aurelia.js

I am working on a project in which I am using Aurelia for the front end.I am facing an issue for many days but still didn't find any solution I am new in Aurelia and I had tried everything.
In this picture you can see there is a required field and a button when we click on this button this should paste the client name in text field everything working fine.
but there is an issue when I am typing anything in the text field and then removing everything and then I click on the button so its saying field is required.
I understood the problem the problem is my validation is triggering on DOM blur event and when I am changing focus the required validation is triggering.
is there anything I can do?
here is some code snippet.
.ensure('candidatevalidatedby')
.displayName('Validated by')
.required()
.maxLength(60)
and
<div class="form-group">
<label>Candidate’s ID validated by *</label>
<input class="form-control" value.bind="candidate.candidatevalidatedby & validate" />
</div>
Thanks In Advance.
Edit: This issue is fixed.
<div class="form-group">
<label>Candidate’s ID validated by *</label>
<input class="form-control" value.bind="candidate.candidatevalidatedby & validateOnChange" />
</div>
This is the solution.
<div class="form-group">
<label>Candidate’s ID validated by *</label>
<input class="form-control" value.bind="candidate.candidatevalidatedby &
validateOnChange" />
</div>
it's working fine.
http://aurelia.io/docs/plugins/validation#validate-binding-behavior
Add max length attribute to your input element. It will work.

MaterializeCSS card-action can only align links, not buttons with forms

I am using the first basic card example from http://materializecss.com/cards.html as a starting point. The card-action div contains two links that render beautifully.
Now I want to add a new card action that doesn't just open a link but performs an action. This could probably be done using a standard link with an tag as well but since I'm using Rails my standard way is that this action becomes a button with a form around it. It looks like this now:
<div class="row">
<div class="col s12 m6">
<div class="card blue-grey darken-1">
<div class="card-content white-text">
<span class="card-title">Card Title</span>
<p>I am a very simple card. I am good at containing small bits of information.
I am convenient because I require little markup to use effectively.</p>
</div>
<div class="card-action">
This is a link
This is a link
<form>
<a class="waves-effect waves-light btn">button</a>
</form>
</div>
</div>
</div>
</div>
I would have expected that the button is nicely aligned with the two existing links, in one row at the bottom of the card. But what actually happens is that the button appears in the line below.
How can I align a button with a form together with standard HTML link tags in one row?
UPDATE: here is a JSFiddle with the code above: https://jsfiddle.net/hendrikbeck/zq1pv3y6/
You just need to add display: inline to your form tag.
See the updated JSFiddle : https://jsfiddle.net/zq1pv3y6/2/

$(document).ready (How to stop .ready on page load and instead allow .ready only when a html link is clicked)

I'm still learning, please help!
I am trying to apply a Modal Popup that appears only when a link is clicked instead of when the page loads. My Modal Popup does all work fine, but I want to turn off/prevent the Popup from appearing at all when the page loads and simply have it only invoke the Popup when my chosen link is clicked.
$(document).ready(function () {
$("#popup-1").myModal({
// Functionality goes below this line
});
});
And this
<div id="popup-1" class="myModal">
<div class="window">
<!-- Your popup content -->
<div class="wrap demo-1">
<div class="title">Some Text Here</p>
<form>
<input type="text" class="field" placeholder="Your email goes here" />
<input type="submit" class="closeModal send" value="Submit" />
</form>
<label class="deny closeModal">Some Text Here</label>
</div>
<div class="cta demo-1">
<span class="icon"></span>
<p>Some Text Here</span></p>
</div>
<!-- / Your popup content -->
</div>
</div>
Is there a simple fix I can apply to solve this issue? I have spent countless hours going through existing posts and forums but almost each enquiry doesnt target the same specific question im trying to achieve based on my actual existing code.
My cose for the Link Click to activate
Newsletter
your help is very much appreciated
Just execute your modal opening code when a link is clicked instead of when the ready event is fired :
$('#modal-link').on('click', function() {
$("#popup-1").myModal({
// Functionality goes below this line
});
});
assuming the link opening your modal is :
link

How can I make an image span rows in bootstrap 3.2?

I am trying to figure out how to get an image/map or whatever, in this case a map, displayed to the right side of my form.
This image shows what I want it to look like. It will be a dynamically generated Google map however.
Here is my current code for the form itself via bootply.
Bootply Example
Thanks!
You need to add another wrapper row and column inside your container.
<div class="row">
<div class="col-md-8">
<!-- Your Form Here-->
</div>
<div class="col-md-4">
<!-- Your Image here-->
</div>
</div>

dojo Expando pane content goes hidden when expanded

I have expandoPane which consists of some buttons.
When I perform other operations in the project and then expand this expandoPane, its contents goes hidden and those are visble after resizing it using splitter only.
I want to solve this.
Do you have any idea why the content goes invisible?
You need to call .startup and .resize() on the content pane when it's shown.
Something like:
expandoPane.connect(this, "onClick", function() {
that.createContent();
that.startup();
that.container.resize()
});
Post your code and I'll probably be able to give you something more specific.
Adding sample code:
<div id="expandableConsole" dojoType="dojox.layout.ExpandoPane" region="bottom" showTitle='true' maxHeight="250px" maxWidth="280px" style="height:200px; width:100%;" doLayout='true' startExpanded='false' splitter="true">
<div>
<input type="button" id="btnSubmit" style="width:88px;height:20px" onclick="update()">
</div>
<div dojoType="dijit.layout.ContentPane" id="infoBar" style="height:150px">
</div>
</div>
When I expand the expandopane after few operations,button and contentpane go invisible.