question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Really need to set value in hidden field programatically

See original GitHub issue

Hi there, i can not find a way to set a value in a field, it is no bound to any onChange event, i just need to set a value. Ideally something like that <Field setValue={some-value} type="hidden" .../> Is there any way to achieve that? If not would anybody be able to point me to where I could add that functionality in the redux-form codebase if I fork it? Thanks a lot!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:18 (2 by maintainers)

github_iconTop GitHub Comments

29reactions
andremecommented, Jan 19, 2017

The component you have wrapped with reduxForm receives a change function in the properties: this.props.change('fieldname', new_value);

5reactions
mCzolkocommented, Dec 5, 2017

This is basically a hidden field. And also I think this would work in React v16 or never.

<Field
    name="name"
    val="John"
    component={({ input, val }) => input.onChange(val)}
/>
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set the value of a input hidden field through JavaScript?
You need to run your script after the element exists. Move the <input type="hidden" name ...
Read more >
How can I set value to hidden field (Form Api) and send them ...
After validation, I set a value to $form['#action'] and to the form fields I need : $form_state->setValue('action', $url_action);.
Read more >
HTML DOM Input Hidden value Property - W3Schools
The value property sets or returns the value of the value attribute of the hidden input field. The value attribute defines the default...
Read more >
jQuery set input hidden field value with demo - Codepedia.info
jQuery Set or Change Input Hidden Field Value: Here in this tutorial will learn how we can set the value to the input...
Read more >
What is a Hidden Field in WordPress Forms? (Practical ...
The most important setting you want to pay attention to is Default Value. This field will load pre-populated with any text entered as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found