How to set values after click in antd rules? - reactjs

I have the following error.
You cannot set a form field before rendering a field associated with the value.
I was trying to set values on the input after clicking.
Any suggestion?

I guess you are trying to access the form element before rendering, which implies you have written some condition for the form rendering.
So wait until the condition satisfies and then access form fields.

Related

React final-form field change while remounting the field seems to not work

I have a form in which I'm listening to changes in a field. Based on this field value, I'm setting the values for another field with form.change('name', 'value') function.
The thing is, that the form is quite dynamic, so the field that I need to change the value of is remounted in a different place of the components tree while being changed. I think that because of that, the change is actually not propagated to the field in final-form. Could someone give me some clue about why is that?
Here is the minimal reproduction of the problem: https://codesandbox.io/s/react-final-form-fields-component-forked-47izwj?file=/index.js

set disabled on a form item through form ref

I am currently using antd-form-builder to build multiple JSON forms for different components and I have an issue with antd trying to use a checkbox to disable another input.. basically I have a function that returns the form meta fields and then in the onChange for the checkbox I am trying to set another field to become disabled
what I have managed to find so far is for the form ref there is a setFields function and I can use this to change the value of another field or the errors on that field through the onChange of the checkbox, however, I cannot change the disabled state of another field.
turns out, this cant be done .. and state variables should be used as mentioned in the issue here

Checkbox with initialValues of true is being displayed without check on refresh

I am seeing this in Edge and IE.
I have a checkbox which is being initialized using initialValues to true.
On first visit its is displayed correctly as checked with a value of true, however after refreshing the page via the browser, the checkbox is not checked but still has a value of true. As i can continue to refresh the page the checkbox continues to switch in this way checked then unchecked on next refresh. redux form 7.2.3 react 15.6.2.
Thanks
The value of a checkbox is what will be associated with its name if it is checked. Checking a checkbox should not change the value, it should change the checked property.
This is not specific to redux-form, it is just how form elements are intended to work. It looks like redux-form wants to use value instead, and it doesn't work right.
In any case, I think you want to specifically handle the checked property with something like checked={value}.
Roy's answer is correct. Adding some redux-form context, passing checked to a Field component will override the normal behaviour. The normal behaviour is to compare if the value stored in redux-form's state is the same as the value prop specified on Field if so the checked prop is true.
So for example if the store state is values: { test: true } and your Field has value={true} then the end result is the checked prop is true.
The F5 refreshing toggle most likely suggests that your values initialization is changing on each refresh. It's hard to help you beyond a general statement like this without clear reproduction steps.

Angular: Set value of text input without creating a model

I have a form that lives inside an ng-repeat. I'm not using ng-model on the form because I don't think there is a need just yet (it's not an AJAX form). I want to set the default value of one of my text input fields to the value of j.some_attribute, where j is the current iteration of ng-repeat. I've tried value="{{j.some_attribute}}" and ng-value="j.some_attribute", but neither one works. When the form is submitted, the value for that field is blank. Is there a way to set the default value of a text input without creating a form model on the scope?

wicket : how to know the current value of checkbox before submission

Is there any way to know the current value of a checkbox in wicket before any action takes place?
wantOnSelectionChangedNotifications() is not useful for me, I want to know the value of the checkbox before clicking on it.
Thanks
first of all in the server you cannot know the state of the input with out a form.
use AjaxFormComponentUpdatingBehavior or AjaxFormSubmitBehavior to attach the event to the checkbox and submit their form. with this aproach you going to submit all components inside the form, if you just want the value of the check you could use a nested form(wicket include support for it)

Resources