jqueryMobile panel theme not working - css

I cannot figure out for the life of my why this jquery mobile panel won't render with the same look and feel of the jquery mobile theme used in the application.
The panel is loading on the same page as the rest of my jquery mobile page so the jquery mobile css files and jquery js files are all referenced and working on other parts of the page.
What am I missing within my layout?
thanks
<div data-role="page" id="map_page">
<div data-role="panel" id="transitLayersPage" data-position="right" data-display="overlay">
<div data-role="header">
<h1>Routes</h1>
</div>
<div data-role="controlgroup">
<div id="checkboxes">
<input type="checkbox" id="transitRoutesLayerKML0" onclick="toggleLayer(0)" />
<label>Routes 1</label>
<input type="checkbox" id="transitRoutesLayerKML1" onclick="toggleLayer(1)" />
<label>Routes 2</label>
<input type="checkbox" id="transitRoutesLayerKML0" onclick="toggleLayer(2)" />
<label>Routes 3</label>
<input type="checkbox" id="transitRoutesLayerKML1" onclick="toggleLayer(3)" />
<label>Routes 4</label>
<input type="checkbox" id="transitRoutesLayerKML0" onclick="toggleLayer(4)" />
<label>Routes 5</label>
<input type="checkbox" id="transitRoutesLayerKML1" onclick="toggleLayer(5)" />
<label>Routes 6a</label>
<input type="checkbox" id="transitRoutesLayerKML0" onclick="toggleLayer(6)" />
<label>Routes 6b</label>
</div>
Close panel
</div>
</div>

You forgot to add for attribute to label. Moreover, you should not use duplicate id for checkbox, each checkbox must have a unique id.
<input type="checkbox" id="foo">
<label for="foo">bar</label>
Demo

Related

Bootstrap - Vertical Radio Buttons not aligned

Im having a problem stacking radio buttons once the screen size reaches a certain size (in this case, 768px for mobile phones). I have this local #media override that takes the radio-inline and displays it as a block - however, once I do this, the first Radio Button "0", is slightly offset and does not align with the rest below it. Any thoughts on a work around or if im doing something wrong?
<style>
#media (max-width: 768px){
.radio-inline{
display:block;
}
}
</style>
<div class="container-fluid">
<div class="jumbotron">
<div>
<asp:Label runat="server" CssClass="h3" ID="Header" Text="EXAMPLE
TEXT"/>
<br />
<br />
<asp:Label runat="server" CssClass="h3" id="S1W" Text="EX1" />
</div>
<div class="row" style="padding-bottom: 30px;">
<div class="col-lg-12">
<label class="radio-inline">
<input type="radio" name="A1" value="0" required> <b>0&nbsp
&nbsp</b>
</label>
<label class="radio-inline">
<input type="radio" name="A1" value="1" required> <b>1&nbsp
&nbsp</b>
</label>
<label class="radio-inline">
<input type="radio" name="A1" value="2" required>
<b>2&nbsp &nbsp</b>
</label>
</div>
</div>
</div>
You need to remove the spaces, "&nbsp", from each input. This should fix the issue as shown in this code snippet. If you need spacing, use CSS.
https://jsfiddle.net/tbuchanan/Lqj412tu/
<label class="radio-inline">
<input type="radio" name="A1" value="0" required> <b>0</b>
</label>

Checkbox values fail if not selected?

I'm building this checkbox that it woyld only work if all 3 checkboxes are checked on the web. Otherwise it will fail.
I tried to set without value - but it doesn't work at all.
I tried to give them the same value as the name or field - doesn't work.
Works only if the value is set as true - but for some reason it expects it all to be true?
<fieldset class="question-fieldset twocolinputs">
<h2>Question #81:</h2>
<div class="answer-single">
<input id="2-a" name="MX3A" type="checkbox" class="checkbox-button-input" value="true">
<label class="answer-label" for="2-a">
Email
</label>
</div>
<div class="answer-single">
<input id="2-b" name="MX3B" type="checkbox" class="checkbox-button-input" value="true">
<label class="answer-label" for="2-b">
SMS
</label>
</div>
<div class="answer-single">
<input id="2-c" name="MX3C" type="checkbox" class="checkbox-button-input" value="true">
<label class="answer-label" for="2-c">
Llamada
</label>
</div>
</fieldset>
In an <input> of type checkbox, you set the checked property to true, not the value:
<input id="2-b" name="MX3B" type="checkbox" class="checkbox-button-input" checked="true">
▲
Update
Demo 2 is an example of radio button pairs with the value of true and false strings submitted to server.
It seems that everyone is assuming that you want the checkboxes checked by default. Although I could be mistaken, I don't interpret it that way. What I gather is that you only get a value submitted if all of your checkboxes are checked which is odd. As a test I have placed your unmodified code inside a <form> and added a <input type='submit'> button, then posted the <form> to a test server. It will only send the values of the checkboxes that are checked as expected.
Demo 1 - PLUNKER
Demo 1 - STACK (Does not function due to SO security measures, see PLUNKER for a functioning example)
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<form id='main' method='post' action='http://httpbin.org/post'>
<fieldset class="question-fieldset twocolinputs">
<h2>
Question #81:
</h2>
<div class="answer-single">
<input id="2-a" name="MX3A" type="checkbox" class="checkbox-button-input" value="true">
<label class="answer-label" for="2-a">
Email
</label>
</div>
<div class="answer-single">
<input id="2-b" name="MX3B" type="checkbox" class="checkbox-button-input" value="true">
<label class="answer-label" for="2-b">
SMS
</label>
</div>
<div class="answer-single">
<input id="2-c" name="MX3C" type="checkbox" class="checkbox-button-input" value="true">
<label class="answer-label" for="2-c">
Llamada
</label>
<input type='submit'>
</div>
</fieldset>
</form>
</body>
</html>
Demo 2 - PLUNKER
Demo 2 - STACK (See PLUNKER for working example)
<!DOCTYPE html>
<html>
<head>
<style>
input,
label {
font: inherit;
}
[type=submit] {
float: right;
}
</style>
</head>
<body>
<form id='main' method='post' action='http://httpbin.org/post'>
<fieldset>
<legend>Question #82</legend>
<p>Using radio buttons that share the same name attribute ensures that only one of them can be checked</p>
<label>True
<input type='radio' name='Q82' value='true'>
</label>
<label>False
<input type='radio' name='Q82' value='false'>
</label>
</fieldset>
<fieldset>
<legend>Question #83</legend>
<p>If you wish to set a default, use the checked attribute. ex. checked='false' (see the radio buttons below)</p>
<label>True
<input type='radio' name='Q83' value='true'>
</label>
<label>False
<input type='radio' name='Q83' value='false' checked='true'>
</label>
</fieldset>
<input type='submit'>
</form>
</body>
</html>
<input id="2-a" name="MX3A" type="checkbox" class="checkbox-button-input" checked>

Twitter Bootstrap - changing height of checkboxes in form

I have a simple HTML form that uses the Twitter Bootstrap framework (v3.1.1). On the smartphone/iPhone these checkboxes are quite small and hard to select with your finger. I would like to make them larger/more spaced out so they are easier to hit but haven't found a way so far - is this even possible.
Here's my form html:
<div class="container">
<div>
<p>Tick all that apply:</p>
<form role="form" action="continue.php" method="post">
<input type="hidden" name="selectionID" value="4567">
<div class="checkbox">
<label>
<input type="checkbox" name="selection[]" value="Fever/Temperature">Apples<br>
<input type="checkbox" name="selection[]" value="Swelling or redness at injection site">Oranges<br>
<input type="checkbox" name="selection[]" value="Pain at injection site">Bananas<br>
<input type="checkbox" name="selection[]" value="Tired/Fatigued">Pears<br>
<input type="checkbox" name="selection[]" value="Irritable">Mangoes<br>
<input type="checkbox" name="selection[]" value="Sleep pattern change">Watermelon<br>
<input type="checkbox" name="selection[]" value="Other">Other<br>
</label>
</div>
<button type="submit" class="btn btn-primary">Next</button>
</form>
</div>
</div>
I've also setup a jsfiddle here
This isn't easy to do cross-broswer .. check out the study made here: http://www.456bereastreet.com/lab/form_controls/checkboxes/
Also, make sure you're using correct HTML code. You should wrap each of your checkboxes with label, like this:
<div class="checkbox">
<label>
<input type="checkbox" name="selection[]" value="Fever/Temperature" />Apples<br/>
</label>
<label>
<input type="checkbox" name="selection[]" value="Swelling or redness at injection site" />Oranges<br/>
</label>
<label>
<input type="checkbox" name="selection[]" value="Pain at injection site" />Bananas<br/>
</label>
<!-- etc. -->
</div>

Twitter Bootstrap - help-inline or help-block for radio/checkbox

What is the proper way to mark up help-inline or help-block for a radio or chechbox field?
This is not displaying as I would expect it to:
<div class="control-group">
<div class="controls">
<label class="radio" for="foo">
<input type="radio" name="foobar" value="foo" id="foo">
Foo label
</label>
<span class="help-inline">Foo inline help</span>
</div>
</div>
EDIT 1:
Follow up question: how do I mark up the second radio option? Wrapped in another div.controls?
See Simbirsk's answer - helped me:
<form class="form-horizontal">
<div class="control-group">
<label class="control-label" for="inputType">Type</label>
<div class="controls">
<input type="text" id="inputType" placeholder="Type">
</div>
</div>
<div class="control-group">
<span class="control-label">Metadata</span>
<div class="controls form-inline">
<label for="inputKey">Key</label>
<input type="text" class="input-small" placeholder="Key" id="inputKey">
<label for="inputValue">Value</label>
<input type="password" class="input-small" placeholder="Value" id="inputValue">
</div>
</div>
</form>
Note that I'm using .form-inline to get the propper styling inside a .controls.
You can test it on this jsfiddle
It would be nice to also write what do you actually expect. I'll have to guess on your expectations here and propose the following solution:
<div class="control-group">
<div class="controls">
<label class="radio" for="foo">
<input id="IsActivated" name="IsActivated" type="radio" value="true">
Is Activated
<span class="help-inline">Foo inline help</span>
</label>
</div>
</div>
We implemented it as follows:
<div class="control-group">
<label class="control-label" for="foo">Foo label</label>
<div class="controls">
<label class="checkbox">
<input id="foo" name="foo" type="radio">
Foo message
</label>
</div>
</div>

jquery mobile radio button icon

hi I have a grouped radio buttons (they look like normal jquery buttons when grouped). and instead of text, i want an icon (or a small image) to be displayed on it. could anyone teach me how can i do this on jquery mobile?
Live Example:
http://jsfiddle.net/uZeDz/6/
Example:
<div data-role="page" id="radio-icons">
<div data-role="content">
<div data-role="fieldcontain">
<fieldset data-role="controlgroup">
<legend>Choose a pet:</legend>
<input type="radio" name="radio-choice-1" id="radio-choice-1" value="choice-1" checked="checked" />
<label for="radio-choice-1"><img src="http://cdn2.iconfinder.com/data/icons/Snow/Snow/snow/Cat.png" /></label>
<input type="radio" name="radio-choice-1" id="radio-choice-2" value="choice-2" />
<label for="radio-choice-2"><img src="http://images.findicons.com/files/icons/8/dog/48/48_dog4.png" /></label>
<input type="radio" name="radio-choice-1" id="radio-choice-3" value="choice-3" />
<label for="radio-choice-3"><img src="http://icon.downv.com/32x32/5/142/1070746.0048c51761d5b53e5a2297e458ba0ff7.gif" /></label>
<input type="radio" name="radio-choice-1" id="radio-choice-4" value="choice-4" />
<label for="radio-choice-4"><img src="http://cdn6.droidmill.com/media/market-media/com.tinyminds.android.widgets.lizardbattery_icon.png" /></label>
</fieldset>
</div>
</div>
</div>

Resources