Search Results

Search found 2048 results on 82 pages for 'checkbox'.

Page 10/82 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • struts2: problem in assigning a variable value to checkbox

    - by vivmal
    Hi All, I am working on struts2. In my jsp page I want to assign the value of a string variable to a checkbox (when it is checked by user). I tried it many times like - <% String code = "decompose"; %> 1) <tr><td> <s:checkbox name="codeCkBox" fieldValue="%{‘code’}" onclick="submit()"/> </td></tr> 2) <tr><td> <s:checkbox name="codeCkBox" value="%{‘code’}" onclick="submit()"/> </td></tr> 3) <tr><td> <s:set name="setCkBoxValue" value="%{‘code’}"/> <s:checkbox name="codeCkBox" fieldValue="# setCkBoxValue" onclick="submit()"/> </td></tr> But everytime when I tried to get this value by checkbox name it returns variable name i.e “code”. Looking for a solution. Thanks in advance.

    Read the article

  • how to prevent checkbox check when clicking on link inside label

    - by dalbaeb
    Hello, I have a link inside a label. The problem is, when user clicks 'back' after having read the terms, the checkbox is unchecked, because when they clicked on the link they also unchecked the box at the same time, since the link is inside a label. <input type="checkbox" id="terms" name="terms" checked="checked" /> <label for="terms">I agree to be bound by the <a href="/terms">Terms</a></label> How can I prevent the checkbox from being checked when link is clicked? Tried doing event.preventDefault() on label click, but that doesn't prevent checkbox from being checked/unchecked. I could just take out the link from inside a label (which means more CSS styling). But now I'm curious whether the above is possible.

    Read the article

  • JQuery validation not working for checkbox group

    - by Chris Halcrow
    I'm having trouble getting JQuery validation to work with a set of checkboxes. I'm generating the checkboxes using an ASP.NET checkboxlist, and I've used JQuery to set the 'name' attribute to the same thing for each checkbox in the list. Here's the code that gets written to the browser. I'm setting the 'validate' attribute on the 1st checkbox to set the rule that at least one checkbox must be selected. The JQuery validation works for all other elements on the form, but not for the checkbox list. I'm also using a JQuery form wizard on the page which triggers validation for each 'page' of the form, so I don't have control over how the validation is called. <input id="ContentPlaceHolder1_MainContent_AreaOfInterest_0" class="ui-wizard-content ui-helper-reset ui-state-default" type="checkbox" value="Famine" name="hello[]" validate="required:true, minlength:1"> <label for="ContentPlaceHolder1_MainContent_AreaOfInterest_0">Famine</label> <br> <input id="ContentPlaceHolder1_MainContent_AreaOfInterest_1" class="ui-wizard-content ui-helper-reset ui-state-default" type="checkbox" value="Events Volunteer" name="hello[]"> <label for="ContentPlaceHolder1_MainContent_AreaOfInterest_1">Events Volunteer</label> Any ideas on what's going wrong? There are lots of examples of JQuery scripts that will do the validation, however I'm trying to avoid this as I'm generating the checkboxlist server side by a custom control so that it can be re-used across different pages that may or may not have JQuery enabled. I'm trying to enable the JQuery validation whilst being as unobtrusive as possible, so that pages will still work even if JQuery is disabled. Here are the relevant JQuery inclusions and JQuery initialisation script for the form wizard. I'm not using any initialisation code for JQuery validation: <script type="text/javascript" src="../js/formwizard/js/bbq.js"></script> <script type="text/javascript" src="../js/formwizard/js/jquery.form.js"></script> <script type="text/javascript" src="../js/formwizard/js/jquery.form.wizard.js"></script> <script type="text/javascript" src="../js/formwizard/js/jquery.validate.js"></script> <script type="text/javascript"> $(document).ready(function () { $("#form1").formwizard({ validationEnabled: true, focusFirstInput: true }); }); </script>

    Read the article

  • Jquery toggle event is messing with checkbox value

    - by John McCollum
    Hi all, I'm using Jquery's toggle event to do some stuff when a user clicks a checkbox, like this: $('input#myId').toggle( function(){ //do stuff }, function(){ //do other stuff } ); The problem is that the checkbox isn't being ticked when I click on the checkbox. (All the stuff I've put into the toggle event is working properly.) I've tried the following: $('input#myId').attr('checked', 'checked'); and $(this).attr('checked', 'checked'); and even simply return true; But nothing is working. Can anyone tell me where I'm going wrong? Edit - thanks to all who replied. Dreas' answer very nearly worked for me, except for the part that checked the attribute. This works perfectly (although it's a bit hacky) $('input#myInput').change(function () { if(!$(this).hasClass("checked")) { //do stuff if the checkbox isn't checked $(this).addClass("checked"); return; } //do stuff if the checkbox isn't checked $(this).removeClass('checked'); }); Thanks again to all who replied.

    Read the article

  • Input checkbox name converts period signs into underlines on post

    - by Rakoon
    Hello I am working on an image gallery at the moment. When a user is logged in, an x appears over each image and a checkbox next to it to enable the user to delete that image. Only if the checkbox is checked will the image be deleted. They are both in a (one for each image in the gallery), the small image "x.gif" is an input type="image" that submits the $_POST form. The checkbox inherits the name of the image and is to prevent accidentally pressing the x button and deleting an image. The problem is that the checkbox name, upon posting it gets converted from (for instance) "Image.jpg" to "Image_jpg" When i test it with print_r($_POST); Should I create code for replacing _jpg or _gif into .jpg and .gif after the post or is there a way to make it possible to use period signs in input names? Any help is greatly appreciated.

    Read the article

  • Checkbox Styling with SelectAll Function

    - by Wilson
    Was styling the checkboxes of my webpage with jquery using the tutorial here But i realized that I could not do SelectAll checkbox that will select all the checkboxes in my list. It works in the backend (the checkboxes are selected) but it does not show in my page. Added a demo to show my problem. May need to port to your system to test it out Demo what can I add to the jQuery Custom Radio-buttons and Checkbox javascript file in the to achieve the select all checkbox function Thank you!

    Read the article

  • GridView CheckBox Disable

    - by zxc
    I have a gridview populated by checkbox using the code below Data Source Result: Branch,101,102,103,104,105,106,107,108,109,110 00001,null,null,null,null,null,null,null,null,null,null 00016,1,1,1,1,1,0,0,0,0,0 00244,1,1,1,1,1,1,1,1,1,1 <asp:TemplateField HeaderText="101"> <ItemTemplate> <asp:CheckBox runat="server" id="cb101" Checked='<%# Eval("101").ToString().Equals("1") %>' /> </ItemTemplate> </asp:TemplateField>... and so on It is properly working for checkbox if if the column is 0 and 1. Now what I need to do is if the column is null the checkbox should be disabled/readonly

    Read the article

  • HTML CheckBox labels within a container are not displayed as expected

    - by Tiny
    The following HTML code attempts to display checkboxes inside a <div></div> container. <div style="overflow: auto; width: auto; display:block; max-height:130px; max-width:200px; background-color: #FFF; height: auto; border: 1px double #336699; padding-left: 2px;"> <label for="chk12" style='white-space: nowrap;'> <input type='checkbox' id="chk12" name='chk_colours' value="12" class='validate[required] text-input text'> <div style='background-color:#FF8C00; width: 180px;' title="darkorange">&nbsp;&nbsp;</div> </label> <label for="chk11" style='white-space: nowrap;'> <input type='checkbox' id="chk11" name='chk_colours' value="11" class='validate[required] text-input text'> <div style='background-color:#D9D919; width: 180px;' title="brightgold">&nbsp;&nbsp;</div> </label> <label for="chk10" style='white-space: nowrap;'> <input type='checkbox' id="chk10" name='chk_colours' value="10" class='validate[required] text-input text'> <div style='background-color:#76EE00; width: 180px;' title="chartreuse2">&nbsp;&nbsp;</div> </label> <label for="chk9" style='white-space: nowrap;'> <input type='checkbox' id="chk9" name='chk_colours' value="9" class='validate[required] text-input text'> <div style='background-color:#2E0854; width: 180px;' title="indigo">&nbsp;&nbsp;</div> </label> <label for="chk8" style='white-space: nowrap;'> <input type='checkbox' id="chk8" name='chk_colours' value="8" class='validate[required] text-input text'> <div style='background-color:#292929; width: 180px;' title="gray16">&nbsp;&nbsp;</div> </label> </div> What it displays can be visible in the following snap shot. It is seen that various colour stripes which are displayed using the following <div> tag <div style='background-color:#FF8C00; width: 180px;' title="darkorange">&nbsp;&nbsp</div> are displayed below their respective checkboxes which are expected to be displayed in a straight line even though I'm using the white-space: nowrap; style attribute. How to display each stripe along with its respective checkbox in a straight line? It was explained in one of my questions itself but in that question each checkbox had a text label in place of such colour stripes. Here it is. I tried to do as mentioned in the accepted answer of that question but to no avail in this case.

    Read the article

  • looping through checkboxes and inserting checkbox values to DB

    - by user1150440
    ASPX Page: <asp:ListView ID="lvSubjects" runat="server" > <LayoutTemplate> <asp:PlaceHolder ID="itemPlaceholder" runat="server" /> </LayoutTemplate> <ItemTemplate> <asp:CheckBox ID="cbRegularSubjects" Text=<%# Eval("SubjectName") %> runat="server" /> </ItemTemplate> <AlternatingItemTemplate> <asp:CheckBox ID="cbRegularSubjects" Text=<%# Eval("SubjectName") %> runat="server" /> </AlternatingItemTemplate> </asp:ListView> Code Behind: For Each ctrl As Control In Page.Controls If TypeOf ctrl Is CheckBox AndAlso CType(ctrl, CheckBox).Checked Then '**Here I want to get the text of the check box and insert into the DB** End If Next Where am i going wrong??i do not get any error...but this code is not working for me.

    Read the article

  • Checkbox Issue with IE8 using jquery

    - by rockers
    I have this code $('#Submit').click(function(event) { var checked = $('.inputchbox'); ......IE8 var ids= checked.map(function() { return $(this).val(); }).get().join(','); alert(ids); }); This Code return all the values which is there for Checkboxbox (.inputchbox is class for the checkbox) but If I give somethign like this var checked = $('.inputchbox input:checkbox:checked'); or var checked = $('.inputchbox input[type=checkbox]:checked'); or var checked = $('.inputchbox input[name=chk]:checked'); or var checked = $('.inputchbox').find('input[type=checkbox]:checked'); if i am giving like this nothing is working for me I am not getting the result in IE8? var checked = $('.inputchbox'); .....this is working but I am getting the checkboxes ids its doesnot checking wheather its checked or not.. I need to get only checked chekcbox id's thanks

    Read the article

  • checkbox val not showing false

    - by user281180
    I have the follwoing code: $("input:checkbox").live('click', function() { alert($(this).val()); }); True is shown if the checkbox is checked. However, if the checkbox is checked and I uncheck it, the value shown is still true. How can I correct that? What is wrong with the code? Thanks

    Read the article

  • checkbox checked with php form post?

    - by Patrick
    how do I check a checkbox? I've tried 1, On, Yes that doesn't work. putting the worked "checked" alone works but then how do I check with php after form post of the checkbox is checked? <input type="checkbox" class="inputcheckbox" id="newmsg" name=chk[newmsg2] value="1" />

    Read the article

  • asp.net selecting a checkbox from the grid view

    - by baburam
    i am trying to get checkbox value ,using c# In grid view the datasource is from oracle i have added the checkbox but the value is not coming please help me in checking the value of check box this is for selecting the candidate if the checkbox is selected the particular candidate name is selected and the candidate names are appended in a string

    Read the article

  • export web page data to excel using javascript [on hold]

    - by Sreevani sri
    I have created web page using html.When i clicked on submit button it will export to excel. using javascript i wnt to export thadt data to excel. my html code is 1. Please give your Name:<input type="text" name="Name" /><br /> 2. Area where you reside:<input type="text" name="Res" /><br /> 3. Specify your age group<br /> (a)15-25<input type="text" name="age" /> (b)26-35<input type="text" name="age" /> (c)36-45<input type="text" name="age" /> (d) Above 46<input type="text" name="age" /><br /> 4. Specify your occupation<br /> (a) Student<input type="checkbox" name="occ" value="student" /> (b) Home maker<input type="checkbox" name="occ" value="home" /> (c) Employee<input type="checkbox" name="occ" value="emp" /> (d) Businesswoman <input type="checkbox" name="occ" value="buss" /> (e) Retired<input type="checkbox" name="occ" value="retired" /> (f) others (please specify)<input type="text" name="others" /><br /> 5. Specify the nature of your family<br /> (a) Joint family<input type="checkbox" name="family" value="jfamily" /> (b) Nuclear family<input type="checkbox" name="family" value="nfamily" /><br /> 6. Please give the Number of female members in your family and their average age approximately<br /> Members Age 1 2 3 4 5<br /> 8. Please give your highest level of education (a)SSC or below<input type="checkbox" name="edu" value="ssc" /> (b) Intermediate<input type="checkbox" name="edu" value="int" /> (c) Diploma <input type="checkbox" name="edu" value="dip" /> (d)UG degree <input type="checkbox" name="edu" value="deg" /> (e) PG <input type="checkbox" name="edu" value="pg" /> (g) Doctorial degree<input type="checkbox" name="edu" value="doc" /><br /> 9. Specify your monthly income approximately in RS <input type="text" name="income" /><br /> 10. Specify your time spent in making a purchase decision at the outlet<br /> (a)0-15 min <input type="checkbox" name="dis" value="0-15 min" /> (b)16-30 min <input type="checkbox" name="dis" value="16-30 min" /> (c) 30-45 min<input type="checkbox" name="dis" value="30-45 min" /> (d) 46-60 min<input type="checkbox" name="dis" value="46-60 min" /><br /> <input type="submit" onclick="exportToExcel()" value="Submit" /> </div> </form>

    Read the article

  • Bottom button bar overlaps the last element of Listview!!

    - by elto
    I have a listview which is part of an Activity. I want user to have a choice for batch deleting the items in the listview, so when he chooses the corresponding option from the menu, every list item gets a checkbox next to it. When user clicks any checkbox, a button bar is to slide up from bottom (as in gmail app) and clicking delete button deletes the selected items, however clicking cancel button on the bar would uncheck all the checked items. This is my page layout.xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@android:color/transparent" > <FrameLayout android:layout_width="fill_parent" android:layout_height="fill_parent" > <LinearLayout android:id="@+id/list_area" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" > <ListView android:id="@+id/mylist" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@android:color/transparent" android:drawSelectorOnTop="false" android:layout_weight="1" /> <TextView android:id="@+id/empty_list_message" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#FFFFFF" android:layout_gravity="center_vertical|center_horizontal" android:text="@string/msg_for_emptyschd" android:layout_margin="14dip" android:layout_weight="1" /> </LinearLayout> <RelativeLayout android:id="@+id/bottom_action_bar" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/schedule_bottom_actionbar_border" android:layout_marginBottom="2dip" android:layout_gravity="bottom" android:visibility="gone" > <Button android:id="@+id/delete_selecteditems_button" android:text="Deleted Selected" android:layout_width="140dip" android:layout_height="40dip" android:layout_alignParentLeft="true" android:layout_marginLeft="3dip" android:layout_marginTop="3dip" /> <Button android:id="@+id/cancel_button" android:text="Cancel" android:layout_width="140dip" android:layout_height="40dip" android:layout_alignParentRight="true" android:layout_marginRight="3dip" android:layout_marginTop="3dip" /> </RelativeLayout> </FrameLayout> </LinearLayout> so far, I have got everything working except that when the bottom bar becomes visible upon checkbox selection, it overlaps the last element of the list. All other list items can be scrolled up, but you cant scroll up the very last item of the list, therefore user can not select that item if he intends to. Here is the screenshot of the overlap. I have tried using the listview footer option, but that appends the bar to the end of the list instead of keeping it fixed at the bottom of the screen. Is there a way I could "raise" the listview enough so that the overlap wont happen?? BTW, I have already tried adding the bottom-margin to the listview itself, or the LinearLayout wrapping the listview right before making the button-bar visible, but it introduces other bugs like clicking one checkbox checks some another checkbox in listview.

    Read the article

  • Abstracting the interpretation of MVC checkboxes values received by the FormsCollection object

    - by Simon_Weaver
    In ASP.NET MVC a checkbox is generated by the HtmlHelper code here: <%= Html.CheckBox("List_" + mailingList.Key, true) %> as this HTML: <input id="List_NEW_PRODUCTS" name="List_NEW_PRODUCTS" type="checkbox" value="true" /> <input name="List_NEW_PRODUCTS" type="hidden" value="false" /> In case you're wondering why is there an extra hidden field? - then read this. Its definitely a solution that makes you first think 'hmmmmm' but then you realize its a pretty elegant one. The problem I have is when I'm trying to parse the data on the backend. Well its not so much of a problem as a concern if anything in future were to change in the framework. If I'm using the built in binding everything is great - its all done for me. But in my case I'm dynamically generating checkboxes with unknown names and no corresponding properties in my model. So i end up having to write code like this : if (forms["List_RETAIL_NOTIFICATION"] == "true,false") { } or this: if (forms.GetValues("List_RETAIL_NOTIFICATION")[0] == "true") { } Both of which i still look at and cringe - especially since theres no guarantee this will always be the return value. I'm wondering if theres a way to access the layer of abstraction used by the model binders - or if I'm stuck with my controller 'knowing' this much about HTTP POST hacks. Yes I'm maybe being a little picky - but perhaps theres a better clever way using the model binders that I can employ to read dynamically created checkbox parameters. In addition i was hoping this this post might help others searcheing for : "true,false". Even though I knew why it does this I just forgot and it took me a little while to realize 'duh'. FYI: I tried another few things, and this is what I found : forms["List_RETAIL_NOTIFICATION"] evaluates to "true,false" forms.GetValues("List_RETAIL_NOTIFICATION")[0] evaluates to "true" (forms.GetValue("List_RETAIL_NOTIFICATION").RawValue as string[])[0] evaluates to "true" forms.GetValues("List_RETAIL_NOTIFICATION").FirstOrDefault() evaluates to "true"

    Read the article

  • Java JCheckBox ArrayList help needed

    - by user2929626
    I'm new to Java and struggling with something which I'm sure must have a simple answer but I can't seem to find it. I have an array of checkbox objects defined as: ArrayList<JCheckBox> checkBoxList A JPanel is created with a grid layout and the checkboxes are added to the JPanel and the ArrayList: for (int i = 0; i < 256; i++) { JCheckBox c = new JCheckBox(); c.setSelected(false); checkBoxList.add(c); mainPanel.add(c); } Yes, there are 256 checkboxes! The panel is added to a JFrame and eventually the GUI is displayed. The user can select any combination of the 256 checkboxes. My class implements Serializable and this ArrayList of checkboxes can be saved and restored using 'Save' and 'Load' GUI buttons. My code to load the saved object is as below: public class LoadListener implements ActionListener { public void actionPerformed(ActionEvent a) { try { // Prompt the user for a load file JFileChooser fileLoad = new JFileChooser(); fileLoad.showOpenDialog(mainFrame); // Create a object/file input stream linking to the selected file ObjectInputStream is = new ObjectInputStream(new FileInputStream(fileLoad.getSelectedFile())); // Read the checkBox array list checkBoxList = (ArrayList<JCheckBox>) is.readObject(); is.close(); } catch (Exception ex) { ex.printStackTrace(); } } On loading the ArrayList object, the values of the checkboxes are correctly populated, however I want to update the checkboxes on the GUI to reflect this. Is there an easy way to do this? I assumed as the array of checkboxes had the correct values that I could just repaint the panel / frame but this doesn't work. I'd like to understand why - does my loaded array of checkbox objects no longer reflect the checkbox objects on the GUI? Any help would be much appreciated. Thanks!

    Read the article

  • Getting multiple checkboxes from FormCollection element

    - by FreshCode
    Given multiple HTML checkboxes: <input type="checkbox" name="catIDs" value="1" /> <input type="checkbox" name="catIDs" value="2" /> ... <input type="checkbox" name="catIDs" value="100" /> How do I retrive an array of integers from a FormCollection in an action: public ActionResult Edit(FormCollection form) { int [] catIDs = (IEnumerable<int>)form["catIDs"]; // ??? // alternatively: foreach (int catID in form["catIDs"] as *SOME CAST*) { // ... } return View(); } Note: I read the related questions and I don't want to change my action parameters, eg. Edit(int [] catIDs).

    Read the article

  • WPF datagrid bind to previous row's cell

    - by James Price
    Hi, I have a datagrid and one of the columns is going to be a checkbox column. To give the background, the checkbox is going to turn something on / off and each row in the datagrid is going to be for a differernt time (in time order, ascending). Is it possible for one row's checkbox to be bound to the state of the previous row? That way if somebody turns off at 10am it will continue to be turned off until such a time that it is turned on again. Hope that makes sense, any help would be great. Sure this sounds like something that should be do-able with databindings just not sure on the way to do it! Thanks.

    Read the article

  • Jquery, checkboxes and isChecked

    - by Ben
    When I bind a function to a checkbox element like: $("#myCheckbox").click( function() { alert($(this).is(":checked")); }); The checkbox changes it checked attribute before the event is triggered, it's it normal behavior, thus giving and inverse result. However, when I do: $("#myCheckbox").click(); The checkbox changes it checked attribute after the event is triggered. My question is, is there a way to trigger the click event from jquery like a normal click would do (first scenario)? PS: I've already tried with trigger('click');

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >