Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Update react final form field

<Form
  mutators={{
    // expect (field, value) args from the mutator
    setValue: ([field, value], state, { changeValue }) => {
      changeValue(state, field, () => value)
    }
  }}
  render={({ form, ...rest }) => {
    // put the reference on a window variable of your choice here
    if (!window.setFormValue) window.setFormValue = form.mutators.setValue

    return (
      <>
        <Field name="field1">...</Field>
        <Field name="field2">...</Field>
        ...
      </>
    )
  }}
/>

// somewhere else, outside of the React application

window.setFormValue('field1', 'value1')
window.setFormValue('field2', 'value2')
Comment

PREVIOUS NEXT
Code Example
Javascript :: Backbone With Express 
Javascript :: Backbone + Express 
Javascript :: name of javascript virtual machine for apple 
Javascript :: Check If Backbone Model Has Property 
Javascript :: Proper Way To Access Model(s) Data From Collection In Backbone 
Javascript :: Check if a number starts with another number or not js 
Javascript :: computed properties in react 
Javascript :: close popup after 5 seconds in jquery 
Javascript :: react custum toogle 
Javascript :: remove duplicate node 
Javascript :: convert text to number 
Javascript :: jquery equivalent of number_format( 
Javascript :: javascript add button 
Javascript :: js 
Javascript :: invalid json response body 
Javascript :: how to take input from user in javascript console 
Javascript :: arrow expression javascript 
Javascript :: date.setdate javascript 
Javascript :: javascript post request 
Javascript :: suitescript dialog box 
Javascript :: Jenkins parse json keep order 
Javascript :: javascript continue with Nested Loop 
Javascript :: Export Multiple Objects 
Javascript :: freecodecamp javascript basic step quoting string 
Javascript :: react linkify 
Javascript :: ex: javascript Executor 
Javascript :: Javascript: take every nth Element of Array 
Javascript :: phaser increment x layers 
Javascript :: phaser show animation play through js 
Javascript :: axios imgbb 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =