my form looks like this :
<form class="form-validate" id="booking-form" name="form-booking" method="post" action="/component/booking/?view=booknig">
<div class="width-60 fltlft">
<fieldset class="form-booking">
<legend></legend>
<ul>
<li><input type="text" readonly="readonly" class="readonly" value="0" id="jform_id" name="jform[id]"></li>
<li><input type="hidden" value="2013-06-17 10:15" name="jform[date_from]"></li>
<li><input type="hidden" value="1" name="jform[service_id]"></li>
<li><label class="" for="jform_phone" id="jform_phone-lbl">Telefon</label><input type="text" class="inputbox" value="" id="jform_phone" name="jform[phone]"></li>
<li><label class="" for="jform_email" id="jform_email-lbl">Email</label><input type="text" class="inputbox" value="" id="jform_email" name="jform[email]"></li>
<li><input type="hidden" value="" id="jform_checked_out" name="jform[checked_out]"></li>
<li><input type="hidden" value="" id="jform_checked_out_time" name="jform[checked_out_time]"></li>
</ul>
</fieldset>
</div>
<input type="hidden" value="booking.save" name="task">
<input type="submit" class="button-submit" value="Send" name="Send">
<input type="hidden" value="1" name="e391ee49d5291fa9d566236f5c0a435e"> <div class="clr"></div>
</form>
and to retrieve POST data i'm using :
$jinput = JFactory::getApplication()->input;
$form_values = $jinput->post->get('jform');
but when i'm tring to print_r $form_values i get only Array
where i'm making mistake
Related
If I click save I want to redirect to userslist view and when I click save and new I want to redirect again to add users view and script "save successfully" but it is too hard to solve. Does anybody have an idea to fix this issue?
This is my view in add form.
<form method="post" action="<?php echo site_url('users/add')?>" >
<label>FirstName</label>
<input type="text" name="first_name" placeholder="Firstname"required>
<label>LastName</label>
<input type="text" name="last_name" placeholder="Lastname"required>
<label>Email</label>
<input type="email" name="email" placeholder="Email"required>
<label>Username</label>
<input type="Username" name="username" placeholder="Username"required>
<label>Password</label>
<input type="password" name="password" id="password" placeholder="Password"required>
<label>Confirm Password</label>
<input type="password" placeholder="Confirm Password" id="confirm_password" required>
<label>Permissions</label>
<input type="text" name="permissions" placeholder="Permissions"required>
<label>Role ID</label>
<input type="text"required name="role_id" placeholder="Role ID"required>
<label>Created By</label>
<input type="text"required name="created_by" placeholder="Created By"required>
<button type="submit" value="formSave">SAVE</button>
<button type="submit" value="formSaveNew">SAVE AND ADD NEW</button>
This is my controller to add
public function add()
{
$this->data['page_title'] = "Add User";
$input_data = $this->input->post();
if(!empty($input_data)){
$this->User_model->insert($input_data);
redirect('/users');
} else {
$this->load->view('templates/master', $this->data);
}
}
I would like to align 2 control group with jQuery Mobile. I use the the version 1.4.2.
This is what I have : http://i.stack.imgur.com/qEAav.png
And this is what I would like to do : http://i.stack.imgur.com/NA9YR.png
My currently code is :
<h3 class="ui-bar ui-bar-a ui-corner-all">
<div id="btnPaie" align="center">
Fermer la liste
</br>
<form>
<fieldset data-role="controlgroup" data-type="horizontal" data-mini="true" id="controlgroupPyramid1">
<input type="radio" class="input-small" name="radio-choice-h-2" id="loadEffectif" value="" checked="checked" onclick="selectorFunctionPaie('age');">
<label for="loadEffectif">Age</label>
<input type="radio" class="input-small" name="radio-choice-h-2" id="loadAnciennete" value="" onclick="selectorFunctionPaie('anciennete');">
<label for="loadAnciennete">Ancienneté</label>
</fieldset>
</form>
<form>
<fieldset data-role="controlgroup" data-type="horizontal" data-mini="true" id="controlgroupPyramid2">
<input type="radio" class="input-small" name="radio-choice-h-2" id="loadEffectif2" value="" checked="checked" onclick="selectorFunctionPaie('effectif');">
<label for="loadEffectif2">Effectif</label>
<input type="radio" class="input-small" name="radio-choice-h-2" id="loadEPT" value="" onclick="selectorFunctionPaie('etp');">
<label for="loadEPT">ETP</label>
</fieldset>
</form>
</div>
</h3>
If there are pro jQuery Mobile I'll glad to solve my problem.
Thanks in advance.
See if this works for you:
<h3 class="ui-bar ui-bar-a ui-corner-all">
<div id="btnPaie">
<form>
<fieldset data-role="controlgroup" data-type="horizontal" data-mini="true" id="controlgroupPyramid2">
<input type="radio" class="input-small" name="radio-choice-h-2" id="loadEffectif2" value="" checked="checked" onclick="selectorFunctionPaie('effectif');" />
<label for="loadEffectif2">Effectif</label>
<input type="radio" class="input-small" name="radio-choice-h-2" id="loadEPT" value="" onclick="selectorFunctionPaie('etp');" />
<label for="loadEPT">ETP</label>
</fieldset>
</form>
<form>
<fieldset data-role="controlgroup" data-type="horizontal" data-mini="true" id="controlgroupPyramid1">
<input type="radio" class="input-small" name="radio-choice-h-2" id="loadEffectif" value="" checked="checked" onclick="selectorFunctionPaie('age');" />
<label for="loadEffectif">Age</label>
<input type="radio" class="input-small" name="radio-choice-h-2" id="loadAnciennete" value="" onclick="selectorFunctionPaie('anciennete');" />
<label for="loadAnciennete">Ancienneté</label>
</fieldset>
</form>
<fieldset data-role="controlgroup" data-type="horizontal" data-mini="true" id="controlgroupPyramid3">
Fermer la liste
</fieldset>
</div>
</h3>
CSS to line things up and add spacing:
#btnPaie {
text-align: center;
}
#btnPaie form, #btnPaie fieldset {
display: inline;
}
#btnPaie fieldset {
margin: 1em;
}
DEMO
Below is the HTML code for a Telerik Tree View Control used in a ASP.NET MVC application. I need to get the value (input tags values are in GUID format) of the ChildNode when a child node checkbox is selected.
Illlustrated below:
*Main Region*
**North VAncouver
testlocation2
Testlocation123**
*Africa*
**Tanzania
Headquarters**
*India*
**Items Gobetter
Mash
YouThinkSo**
*Canada*
**WestVancouver**
AS given above I was wondering if you could give me the Jquery code to iterate through the HTML markup and select checked child node values given in GUID's.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content=
"HTML Tidy for Linux/x86 (vers 11 February 2007), see www.w3.org" />
<title></title>
</head>
<body>
<ul>
<li>
<span id="spnloc">Locations</span>
<div style=
"position: absolute; padding-top: 5px; background-color: rgb(234, 234, 234); color: rgb(63, 138, 196); z-index: 2000; display: none;"
id="TreeView1" class="t-widget t-treeview t-reset">
<ul class="t-group t-treeview-lines">
<li class="t-item t-first">
<div class="t-top">
<span class="t-checkbox"><input type="hidden" value="0" name=
"TreeView1_checkedNodes.Index" class="t-input" /><input type="checkbox"
value="True" name="TreeView1_checkedNodes[0].Checked" class="t-input"
checked="checked" /><input type="hidden" value="Main Region" name=
"TreeView1_checkedNodes[0].Text" class="t-input" /><input type="hidden"
value="Main Region" name="TreeView1_checkedNodes[0].Value" class=
"t-input" /></span><span class="t-in">Main Region</span><input type=
"hidden" value="Main Region" name="itemValue" class="t-input" />
</div>
<ul class="t-group">
<li class="t-item">
<div class="t-top">
<span class="t-checkbox"><input type="hidden" value="0:0" name=
"TreeView1_checkedNodes.Index" class="t-input" /><input type="checkbox"
value="False" name="TreeView1_checkedNodes[0:0].Checked" class=
"t-input" /></span><span class="t-in">North
Vancouver</span><input type="hidden" value=
"5761a893-9ef0-48d3-847a-2638ec081f5f" name="itemValue" class=
"t-input" />
</div>
</li>
<li class="t-item">
<div class="t-mid">
<span class="t-checkbox"><input type="hidden" value="0:1" name=
"TreeView1_checkedNodes.Index" class="t-input" /><input type="checkbox"
value="False" name="TreeView1_checkedNodes[0:1].Checked" class=
"t-input" /></span><span class="t-in">testLocation2</span><input type=
"hidden" value="d63d6ff6-07dc-4021-a4bb-7b1b7c781119" name="itemValue"
class="t-input" />
</div>
</li>
<li class="t-item t-last">
<div class="t-bot">
<span class="t-checkbox"><input type="hidden" value="0:2" name=
"TreeView1_checkedNodes.Index" class="t-input" /><input type="checkbox"
value="False" name="TreeView1_checkedNodes[0:2].Checked" class=
"t-input" /></span><span class=
"t-in">TestLocations123</span><input type="hidden" value=
"eadfd0f5-9181-4094-b01a-9d7ee383b7f2" name="itemValue" class=
"t-input" />
</div>
</li>
</ul>
</li>
<li class="t-item">
<div class="t-mid">
<span class="t-checkbox"><input type="hidden" value="1" name=
"TreeView1_checkedNodes.Index" class="t-input" /><input type="checkbox"
value="True" name="TreeView1_checkedNodes[1].Checked" class="t-input"
checked="checked" /><input type="hidden" value="Africa" name=
"TreeView1_checkedNodes[1].Text" class="t-input" /><input type="hidden"
value="Africa" name="TreeView1_checkedNodes[1].Value" class=
"t-input" /></span><span class="t-in">Africa</span><input type="hidden"
value="Africa" name="itemValue" class="t-input" />
</div>
<ul class="t-group">
<li class="t-item">
<div class="t-top">
<span class="t-checkbox"><input type="hidden" value="1:0" name=
"TreeView1_checkedNodes.Index" class="t-input" /><input type="checkbox"
value="False" name="TreeView1_checkedNodes[1:0].Checked" class=
"t-input" /></span><span class="t-in">Tanzania</span><input type="hidden"
value="5c2389eb-365e-42bb-9b1a-8db36f87b4af" name="itemValue" class=
"t-input" />
</div>
</li>
<li class="t-item t-last">
<div class="t-bot">
<span class="t-checkbox"><input type="hidden" value="1:1" name=
"TreeView1_checkedNodes.Index" class="t-input" /><input type="checkbox"
value="True" name="TreeView1_checkedNodes[1:1].Checked" class="t-input"
checked="checked" /><input type="hidden" value="Headquarters" name=
"TreeView1_checkedNodes[1:1].Text" class="t-input" /><input type=
"hidden" value="ac171662-3eca-411f-a623-a3cb1a69238e" name=
"TreeView1_checkedNodes[1:1].Value" class=
"t-input" /></span><span class="t-in">Headquarters</span><input type=
"hidden" value="ac171662-3eca-411f-a623-a3cb1a69238e" name="itemValue"
class="t-input" />
</div>
</li>
</ul>
</li>
<li class="t-item">
<div class="t-mid">
<span class="t-checkbox"><input type="hidden" value="2" name=
"TreeView1_checkedNodes.Index" class="t-input" /><input type="checkbox"
value="True" name="TreeView1_checkedNodes[2].Checked" class="t-input"
checked="checked" /><input type="hidden" value="India" name=
"TreeView1_checkedNodes[2].Text" class="t-input" /><input type="hidden"
value="India" name="TreeView1_checkedNodes[2].Value" class=
"t-input" /></span><span class="t-in">India</span><input type="hidden"
value="India" name="itemValue" class="t-input" />
</div>
<ul class="t-group">
<li class="t-item">
<div class="t-top">
<span class="t-checkbox"><input type="hidden" value="2:0" name=
"TreeView1_checkedNodes.Index" class="t-input" /><input type="checkbox"
value="False" name="TreeView1_checkedNodes[2:0].Checked" class=
"t-input" /></span><span class="t-in">Item's Go Here</span><input type=
"hidden" value="d8266db4-e846-4338-906f-e0b84fd9044a" name="itemValue"
class="t-input" />
</div>
</li>
<li class="t-item">
<div class="t-mid">
<span class="t-checkbox"><input type="hidden" value="2:1" name=
"TreeView1_checkedNodes.Index" class="t-input" /><input type="checkbox"
value="False" name="TreeView1_checkedNodes[2:1].Checked" class=
"t-input" /></span><span class="t-in">MASH</span><input type=
"hidden" value="869c083a-a17b-4a7a-a2a9-ef88f972de1b" name="itemValue"
class="t-input" />
</div>
</li>
<li class="t-item t-last">
<div class="t-bot">
<span class="t-checkbox"><input type="hidden" value="2:2" name=
"TreeView1_checkedNodes.Index" class="t-input" /><input type="checkbox"
value="False" name="TreeView1_checkedNodes[2:2].Checked" class=
"t-input" /></span><span class="t-in">YouThinkSo</span><input type=
"hidden" value="4e33e582-8a54-450a-ad73-70698a578162" name="itemValue"
class="t-input" />
</div>
</li>
</ul>
</li>
<li class="t-item t-last">
<div class="t-bot">
<span class="t-checkbox"><input type="hidden" value="3" name=
"TreeView1_checkedNodes.Index" class="t-input" /><input type="checkbox"
value="True" name="TreeView1_checkedNodes[3].Checked" class="t-input"
checked="checked" /><input type="hidden" value="Canada" name=
"TreeView1_checkedNodes[3].Text" class="t-input" /><input type="hidden"
value="Canada" name="TreeView1_checkedNodes[3].Value" class=
"t-input" /></span><span class="t-in">Canada</span><input type="hidden"
value="Canada" name="itemValue" class="t-input" />
</div>
<ul class="t-group">
<li class="t-item t-last">
<div class="t-top t-bot">
<span class="t-checkbox"><input type="hidden" value="3:0" name=
"TreeView1_checkedNodes.Index" class="t-input" /><input type="checkbox"
value="False" name="TreeView1_checkedNodes[3:0].Checked" class=
"t-input" /></span><span class="t-in">West Vancouver</span><input type=
"hidden" value="b8fd4a6f-bfc7-4c8a-b2ff-cb3c278c7434" name="itemValue"
class="t-input" />
</div>
</li>
</ul>
</li>
</ul>
</div>
</li>
</ul>
</body>
</html>
In italics are the Regions (Parent nodes) and in Bold are the child nodes. Both Region and child nodes(which are locations) are Checkboxes.
The values of the Child Nodes are in GUID (Unique Indentiifer) value.
ON selecting the the parent and child nodes I need to be able to only get the value of the child nodes after I select the nodes and maybe click a button to run the JQuery code. Can you help me with the Jquery code that will be able to give me the selected values of the checkboxes(child nodes only) ignoring the parent checkboxes even if they are selected. The HML markup for the TreeView is given ABOVE.
Not sure if this is what you want
Demo: http://jsfiddle.net/qHJYJ/
by clicking the button will return GUID of all children nodes that have
Parent Node selected
Children Node itself selected
$('input[type="checkbox"]').on('change', function() {
var e = $(this);
if (e.parents('li:eq(2)').length) {
console.log('sub-checkbox found, value: ' + e.val());
} else {
console.log('parent checkbox has been changed, ignoring...');
}
console.log(e.attr('name'));
});
jsFiddle example code here
I want to group certain checkboxes and make them collapsible as well as select/unselect all.
HTML
<div style="padding-left: 5px; padding-right: 5px">
<fieldset data-role="controlgroup">
<input autocomplete="off" type="checkbox" name="layers" id="land" class="layers" checked="checked"/>
<label for="land">Land Parcels</label>
<input autocomplete="off" type="checkbox" name="layers" id="road" class="layers" checked="checked"/>
<label for="road">Roads</label>
<input autocomplete="off" type="checkbox" name="layers" id="rail" class="layers" checked="checked"/>
<label for="rail">Railroads</label>
input autocomplete="off" type="checkbox" name="layers" id="lake" class="layers" checked="checked"/>
<label for="lake">Lakes</label>
<input autocomplete="off" type="checkbox" name="layers" id="points" class="layers"/>
<label for="points">AMIS Points</label>
<input autocomplete="off" type="checkbox" name="education" id="education" class="layers"/>
<label for="education">Education</label>
<input autocomplete="off" type="checkbox" data-mini="true" name="education" id="childcare" class="layers"/>
<label for="childcare">Child Care</label>
<input autocomplete="off" type="checkbox" data-mini="true" name="education" id="highschool" class="layers"/>
<label for="highschool">High School</label>
<input autocomplete="off" type="checkbox" name="layers" id="stormpipes" class="layers"/>
<label for="stormpipes">Storm Pipes</label>
</fieldset>
</div>
JQuery
$(document).ready(function () {
fixContentHeight();
$('.layers').click(changeLayers);
});
function changeLayers () {
var checked = [];
$('.layers').each(function () {
if ($(this).attr('checked')) {
checked.push($(this).attr('value'));
}
});
mainLayer.params.LAYERS = checked.join(",");
mainLayer.redraw();
}
$('#education').click(function() {
$("INPUT[type='checkbox']").attr('checked', $('#education').is(':checked'));
});
Trying to make child care and high school collapisble within the education checkbox.
You could use an unordered list with data-role="listview", add data-role="collapsible" to the li elements, and nest another unordered list with each checkbox inside the inner list's li
<ul data-role="listview">
<li data-role="collapsible">
<h3>Title of collapsible row</h3>
<ul data-role="listview">
<li>
<input autocomplete="off" type="checkbox" name="layers" id="land" class="layers" checked="checked"/>
<label for="land">Land Parcels</label>
</li>
<li>
<input autocomplete="off" type="checkbox" name="layers" id="road" class="layers" checked="checked"/>
<label for="road">Roads</label>
</li>
</ul>
</li>
</ul>
The margins and paddings will look a bit weird, but you can just tweak the css to fix that
Html:
<input type="checkbox" value="1" name="my_checkbox[]">
<input type="checkbox" value="2" name="my_checkbox[]">
<input type="checkbox" value="3" name="my_checkbox[]">
In action:
$arr= $request->getParameter('my_checkbox[]');
This does not work.
Any solution?
How about this:
$arr = $request->getParameter('my_checkbox');