lundi 3 juin 2019

How should i set checkbox value to false on single click?

On my edit operation, my check-boxes gets filled according to values stored in database. I am using same form for edit and add operations. Now when I click on edit and unchecked the checkbox, it does not return false on single click, it returns false when i double click (for ex uncheck(returns true) -> check(returns true) -> uncheck(returns false)). I want checkbox to return false on single click when unchecked, if it is brings checked value.

controller.js

 $scope.edit = function (user) {
  if (user.Form1007 == "True") {
            $('#Form1007').attr('checked', true);
        }
        else {
            $('#Form1007').attr('checked', false);
        }
};

form.html

<div class="form-group" style="padding-top: 10px;">
 <label for="inputEmail3" class="col-sm-3 control-label">Form 1007 :</label>
 <div class="col-sm-8">
  <input type="hidden" name="Form1007" value="false" /> 
  <input ng-model="form.Form1007" name="Form1007" type="checkbox"id="Form1007" value="True"/>
    </div>
 </div>
``




Unable to find CheckBox items with SeleniumWebDriver using C#

I need to write some AUTOMATED TCs for an web application but I can`t find using SeleniumWebDriver a checkbox button .

I tried with Xpath, ClassName but nothing helps me

<label class ="select-label custom-control-label" for="77486440">
::before
::after
</label>

I expected to check / click on CheckBox item




dimanche 2 juin 2019

How to get variable/inconstant checkbox id and values in j query?

I am getting all the community name from sql database and showing drop-down with checkbox. for that i am using for-each loop to show values.

Below is my code fetching $results array from database and showing it in the check box

    <div class="btn-group">
    <button type="button" data-toggle="dropdown" title="Columns">
    Columns
    <b class="caret">
    </b>
   </button>
    <ul class="dropdown-menu">
    <?php  foreach( $results as $result){ 
    ?>
    <li>
    <label class="checkbox">
    <input type="checkbox" id="<?php echo $result['community_name']; ?>" 
    name="multiselect" value="<?php echo $result['community_name']; ?>"><? 
    php echo $result['community_name']; ?></input>
    </label>
    </li>
    <?php } ?>
    </ul>
    </div>   

So how to fetch all the checked and unchecked values in Jquery ??

Please help

Thnks




Linked Semantic UI checkboxes won't uncheck when onChange is set to anchor links

I'm using Semantic UI checkboxes as an element in an ecommerce filter design. I want users to be able to check a field and than have that section scroll to them (the checkbox area is fixed). I've got this working once, but the checkboxes won't uncheck.

I've linked the checkboxes to anchor links on the page using onChange="if(this.checked)...

<div class="group-checkboxes grouped fields">
  <div class="field">
    <div class="ui checkbox">
      <input type="radio" name="legacy" id="ch-legacy" onchange="if(this.checked) document.location.href='#product-legacy';" />
      <label for="ch-legacy">Legacy</label>
    </div>
  </div>
  <div class="field">
    <div class="ui checkbox">
      <input type="radio" name="reserve" id="ch-reserve" onchange="if(this.checked) document.location.href='#product-reserve';" />
      <label for="ch-reserve">Proprietor's Reserve</label>
    </div>
  </div>
  <div class="field">
    <div class="ui checkbox">
      <input type="radio" name="gifts" id="ch-gifts" onchange="if(this.checked) document.location.href='#product-gifts';" >
      <label for="ch-gifts">Gifts</label>
    </div>
  </div>
  <div class="field">
    <div class="ui checkbox">
      <input type="radio" name="sundries" id="ch-sundries" onchange="if(this.checked) document.location.href='#product-gifts';" >
      <label for="ch-sundries">Grocery & Sundry</label>
    </div>
  </div>
</div>

I expected each checkbox's onChange to override the next, but they're not — if all checkboxes are checked, the user is stuck.

I'm not sure if I should try to somehow untoggle the checkboxes when the next box is checked, or if I should try something different instead of onChange.




samedi 1 juin 2019

Difficulty keeping checkbox's generated by Contact Form 7 inline with their labels

I am designing my website using WordPress and have a Contact Form 7 that is giving me formatting issues. The following code is what I used in the Contact Form 7 plugin:

[checkbox checkbox-584 use_label_element "Competitive Market Analysis (CMA) - For Sale" "Competitive Market Analysis (CMA) - For Rent" "Property Management Agreement Forms" "Request in-home visit" "Request office appointment"]

... and it generates the following HTML on my site:

<span class="wpcf7-list-item first">
  <label>
    <input type="checkbox" name="checkbox-584[]" value="Competitive Market Analysis (CMA) - For Sale">
    <span class="wpcf7-list-item-label">Competitive Market Analysis (CMA) - For Sale</span>
  </label>
</span>

The snippet above repeats for each of my checkbox items.

On both Safari and Chrome for MacOS the checkbox appears "normal" size, but the line wraps before the label is shown. On my iPad with Safari the checkbox is much taller than it should be.

What I'm really trying to accomplish here is keeping the label on the same line next to the checkbox. I've found very similar problems all over the web and none of the solutions that worked for others seem to work in my case. Adding the CSS line "span.wpcf7-list-item {display:block;}" to my wordpress theme does prevent multiple checkboxes from displaying on the same line, so I know my css is being utilized and I have the right class, but the Safari web inspector indicates the checkbox itself it taking the entire width.

I'm probably doing a horrible job of explaining this. The website in question is bamcisrealty.com/property-management, and here's a screenshot of where the problem seems to be. Any assistance is greatly appreciated, thanks!.

screenshot of safari web inspector results




CheckBox Command inside a Listview DataTemplate

My CheckBox Command Does not work. I am pretty sure it is because it is within a ListView DataTemplate (since the CheckBox Command works when not inside a Template). Can someone show me how to set this up? If you can explain it to me too that would be great! thanks.

<ListView x:Name="lvReferraSource" ItemsSource="{Binding ReferralSourceTypeObsCollection}" Style="{StaticResource TypeListViewStyle}">
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Vertical">
                                    <CheckBox x:Name="ckbReferralIsChecked" Content="{Binding Value}" IsChecked="{Binding Active}" Style="{StaticResource CheckBoxStyleBase2}"
                                              Command="{Binding CheckBoxIsChecked}" CommandParameter="{Binding IsChecked, RelativeSource={RelativeSource Self}}" >
                                    </CheckBox>
                                </StackPanel>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>



private ICommand _CheckBoxIsChecked;
public ICommand CheckBoxIsChecked
    {
        get
        {
            if (_CheckBoxIsChecked == null)
            {
                _CheckBoxIsChecked = new RelayCommand<object>(ExecuteCheckBoxIsChecked, CanExecuteCheckBoxIsChecked);
            }

            return _CheckBoxIsChecked;
        }
    }
    public bool CanExecuteCheckBoxIsChecked(object parameter)
    {
        return true;
    }
    public void ExecuteCheckBoxIsChecked(object parameter)
    {
        Mouse.OverrideCursor = Cursors.Wait;

        if (parameter != null)
        {
            bool isChecked = (bool)parameter;
        }

        Mouse.OverrideCursor = Cursors.Hand;
    }




value (name, price) of checked checkbox to another activity

Use Andriod studio, Java Display the screen with corresponding food items. For example, the vegetable screen will display kale, onions,.... Use check boxes to show the food items. Then selected checkbox food item and prices will be displayed on checkout screen(another activity)

(send values(total price, name) of checked checkboxes in one activity to another activity)

Below is what I have now

public class Vegetables extends FoodTypesMenu  {

    CheckBox cb1, cb2, cb3, cb4;

    String name = "";
    String vegprice = "";

    double vegPrice = 0;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_vegetables);



    }

    public void onCheckboxClicked(View view) {
        //Is the button now checked?
        boolean checked = ((CheckBox) view).isChecked();

        Button btnNext = (Button) findViewById(R.id.bn1);

        switch (view.getId()) {
            case R.id.onion_cb:
                if(checked){
                   name="Onion";
                   vegPrice += 5;

                }
                break;
            case R.id.carrot_cb:
                if(checked){
                  name="Carrot";

                }

                break;
            case R.id.spinach_cb:
                if(checked){
                    name="Spinach";


                }
                break;
            case R.id.garlic_cb:
                if(checked){
                    name="Garlic";


                }
                break;

        }

    }

    public void tocheckout(View v) {

        Intent intent = new Intent(this, CheckOut.class);
        intent.putExtra("Name", name);
        startActivity(intent);
        startActivity(intent);

    }

    }
```

```
public class CheckOut extends FoodTypesMenu {



    String name = "";
    String price = "";


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_check_out);



        String name = getIntent().getStringExtra("Name");

        }

        public void OnClickButton (View view){
            Intent intent2 = new Intent(this, Payment.class);
            this.startActivity(intent2);
    }




    }



The string name is not displayed and also don't know how to display total price of checked boxes on another activity

[enter image description here][2]


  [1]: https://i.stack.imgur.com/Mag7P.png
  [2]: https://i.stack.imgur.com/1kw6X.png