mardi 2 juin 2020

How to add checkbox to my recyclerviewer xml?

I created Recyclerviewer inside the fragment. Viewer consists of 2 textviews - vertical and I have underline divider under those textviews. How can I add checkbox which will be right of my first textview, but keep second textview as a same group so I don't get 2 underline dividers? More details on this image: enter image description here

item_tab1 xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">
    <TextView
        android:id="@+id/Item1Name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Ïtem 1"
        android:textSize="30dp"
        android:textStyle="bold"></TextView>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="SubName"
        android:textSize="15dp"
        android:id="@+id/Item1SubName">
    </TextView>
</LinearLayout>



Push checked values into an array - Nodejs/Express

How can one push a checked value from a form into an array using Node.js?

From what I know there is no object document in Node.js, but I'm not sure the best work around.

var cities = [];
var checkboxes = document.querySelectorAll('input[type=checkbox]:checked');
for (var i = 0; i < checkboxes.length; i++) {
  cities.push(checkboxes[i].value);
}

Form below:

<form action="/cities" method="POST" enctype="multipart/form-data">
   <div class="form-group">
      <label class="form-label">Cities</label>
      <ul class="list-inline mb-0">
         <li class="list-inline-item">
            <div class="custom-control custom-checkbox">
               <input class="custom-control-input" type="checkbox" id="cities_0" name="cities[]" value="Milan">
               <label class="custom-control-label text-muted" for="cities_0">Milan    </label>
            </div>
         </li>
         <li class="list-inline-item">
            <div class="custom-control custom-checkbox">
               <input class="custom-control-input" type="checkbox" id="cities_1" name="amenities[]" value="Paris">
               <label class="custom-control-label text-muted" for="cities_1">Paris   </label>
            </div>
         </li>
      </ul>
   </div>
</form>



vue checkbox insanity, how to toggle a global checkbox if all checkboxes inside it are true

how can i do a checkbox system with a structure like: i have multiple checkbox groups and each of them got there very own checkboxes inside. and if all children checkboxes inside are true then toggle the daddy checkbox to true. if either one of the children are false, then toggle the checked="true" from the daddy checkbox to false. the daddy checkbox should only be true if all of his own children are set to true.

i did a little codesandbox to show what i mean.

This is the tale of the childrens and there daddy (checkbox)




How to make an interactive checklist in Rstudio Shiny

I'm trying to build a checklist that will show me different parts of my data in Rstudio using Shiny.

For example: If I check question A: Row 1:2 should show in my table If I check question B while A is still checked: I want to see row 1:2 & 5. If I uncheck question B but check question C while A is still checked: I want to see row 1:2 & 3:4

I made 2 versions but I'm stuck on both

Version 1 (were I'm having trouble with the if statements in the server):

if (interactive()) {

library(shiny)
library(readxl)
Sheet2 <- read_excel("Sheet2.xlsx")
Sheet3 <- read_excel("Sheet3.xlsx")
Sheet4 <- read_excel("Sheet4.xlsx")



ui <- fluidPage(
  title = "Checklist",
  sidebarLayout(
    sidebarPanel(   

      checkboxInput(inputId = "A",
                                  label = strong("A"),
                                  value = FALSE),

      conditionalPanel(condition = "input.A == true", 
                       checkboxInput(inputId = "B",
                                     label = strong("B"),
                                     value = FALSE)),

      checkboxInput(inputId = "C",
                    label = strong("C"),
                    value = FALSE)

      ),
    mainPanel(
      tabsetPanel(
        id = 'dataset',
        tabPanel("Sheet2", DT::dataTableOutput("mytable1")),
        tabPanel("Sheet3", DT::dataTableOutput("mytable2")),
        tabPanel("Sheet4", DT::dataTableOutput("mytable3"))
      )
    )
  )
)

server <- function(input, output) {

  output$mytable1 <- 
    DT::renderDataTable({
      if (input$A){
        DT::datatable(Sheet2[1:2,])}
      if (input$C){
        DT::datatable(Sheet2[3:4,])}
      if (input$B){
        DT::datatable(Sheet2[5,])
      }
    })


  output$mytable3 <- 
    DT::renderDataTable({if ((input$A)){
      DT::datatable(Sheet3[3:4,])}
    })

}

shinyApp(ui, server)

}

And version 2 (were i cant add multiple rows to my groupinput):

if (interactive()) {
library(shiny)
library(readxl)
Sheet2 <- read_excel("Sheet2.xlsx")
Sheet3 <- read_excel("Sheet3.xlsx")
Sheet4 <- read_excel("Sheet4.xlsx")
B3 <- 3:4


ui2 <- fluidPage(
  title = "M&A Checklist",
    mainPanel(
      tabsetPanel(
        id = 'dataset',
        tabPanel("Sheet1", checkboxGroupInput(inputId = "show_vars", 
                                              label = "Questions:", 
                                              choiceNames = c("AAAAAAAAAA","BBBBBBBBBB","CCCCCCCCCCC"), 
                                              choiceValues = c("1","B3","5") )),
        tabPanel("Sheet2", DT::dataTableOutput("mytable1")),
        tabPanel("Sheet3", DT::dataTableOutput("mytable2")),
        tabPanel("Sheet4", DT::dataTableOutput("mytable3"))
    )
  )
)

server2 <- function(input, output) {

  # choose columns to display
  output$mytable1 <- DT::renderDataTable({
    DT::datatable(Sheet2[input$show_vars,])
  })

  # sorted columns are colored now because CSS are attached to them
  output$mytable2 <- DT::renderDataTable({
    DT::datatable(Sheet3[input$show_vars,])
  })

  # customize the length drop-down menu; display 5 rows per page by default
  output$mytable3 <- DT::renderDataTable({
    DT::datatable(Sheet4[input$show_vars,] )
  })

}

shinyApp(ui2, server2)
}

Any suggestions, on how this can be done efficiently?




How to create a "waiting" queue when there are more than 2 visitors on the website

Hello, I use a form on my website. This form contains content that can only be selected once.

I would like to create some sort of "queue" when there is more than one visitor on the page.

So for example 2 visitors: visitor 1 -> fill in the form. visitor 2 -> gets popup with "please wait" visitor 1 -> sends the form. system processes data from form. visitor 2 -> make popup invisible and show form.

Or another option would be to check if someone else has checked the checkbox yet and give a message if someone has checked this yet.




Yes/No Checkbox change

I have a Yes/No field in my database. When I create a report it just give me a blank block. Which is correct, however I want to have a Yes and No writing in the place of the checkbox. How can I do this please.




lundi 1 juin 2020

Copy selected multiple values to the text box

I have drop down list as below.

     <select id="checkOwner" multiple="multiple" onchange="copyValue()">
       <option value="FIRSTNAME">First Name</option>
       <option value="LASTNAME">Last Name</option>
     </select>

I used below javascript to copy selected value to text field.

function copyValue() {
  var dropboxvalue = document.getElementById('checkOwner').value;
  document.getElementById('mytextbox').value = dropboxvalue;
}

But the problem is, this copy only one value. I want to copy all the selected values. How can I do this?