Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

controlled autocomplete material ui

<Controller
  defaultValue={null}
  name={"name"}
  control={control}
  rules={{
    required: true, // for mandatory field
    validate: (data) => { // checking whether array is empty or not
    	if(data.length === 0) return false 
    }}
  }
  render={({value, name, onChange}) => (
  	<Autocomplete
      value={value}
      multiple
      name={name}
      size="small"
      id="status"
      options={options}
      disableCloseOnSelect
      onChange={(e, v) => {onChange(v);} }
      getOptionLabel={(option) => option.name}
      renderOption={(props, option, { selected }) => (
        <li {...props}>
          <Checkbox
          icon={icon}
          checkedIcon={checkedIcon}
          style={{ marginRight: 8 }}
          checked={selected}
        />
        	{option.name}
        </li>
      )}
      style={{ width: 250 }}
      renderInput={(params) => (
      	<TextField {...params} /* error={errors.name ? true : false} */ variant="outlined" label="Select" />
      )}
    />
  )}
/>
Comment

PREVIOUS NEXT
Code Example
Javascript :: nodejs mysql getting the id of an inserted row 
Javascript :: javascript find object in array 
Javascript :: js add html element to div 
Javascript :: mongodb $in regex 
Javascript :: boolean object js 
Javascript :: for of loop javascript 
Javascript :: node js example 
Javascript :: javascript code 
Javascript :: find all subsets of an array javascript 
Javascript :: Angular Laravel has been blocked by CORS policy: Request header field x-requested-with is not allowed by Access-Control-Allow-Headers in preflight response. 
Javascript :: routes react 
Javascript :: javascript log html element as dom object 
Javascript :: float to euro curency 
Javascript :: for in 
Javascript :: js get url variables 
Javascript :: javascript indexof 
Javascript :: extract all link with javascript 
Javascript :: how to run function after animation complete jquery 
Javascript :: datatables search not working 
Javascript :: jquery hover and hover out 
Javascript :: worker timeout 
Javascript :: bootstrap datepicker options 
Javascript :: Uncaught TypeError: Object prototype may only be an Object or null: undefined 
Javascript :: js password generator 
Javascript :: queryselector get each element 
Javascript :: toggle button javascript 
Javascript :: js fetch encode url 
Javascript :: join a list of strings into one string javascript 
Javascript :: js browser tab inactive check 
Javascript :: javascript collection to array 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =