Ant deisgn set field value for an array field - antd

I am new to ant design 4.0.1. I want to set field value for a an array field using the index. This is what I have currently done. I want to know the correct syntax. Assistance will be greatly appreciated.
form.setFieldsValue({
[("userPaymentInstruction", `${index}`, "payment_provider_id")]: "",
});

Related

Form with rows, trying to get the values as a array object

I am trying to create row based form with ant design form component. It will look like the screenshot.
Getting the submitted value as a single object as shown in the screenshot(console).
Is there any simple way/solution to archive it by an array object with each row values like below.
[{
receiver_name0: "Jaison 1",
receiver_email0: "jaison1#gmail.com",
receiver_phone0: "05555555"
},{
receiver_name1: "Jaison 2",
receiver_email1: "jaison2#gmail.com",
receiver_phone1: "06666666"
}]
Thanks in advance.
Assuming you are using getFieldDecorator provided by antd Form, the first argument the getFieldDecorator is a string that is a path to where the value should be set. It works pretty much like lodash _.set().
Check out this: https://github.com/react-component/form/pull/48
To set form values in an array you can try something like this from the example in the PR:
{getFieldDecorator('row[0].receiverName', {})(<input/>)}
{getFieldDecorator('row[1].receiverName', {})(<input/>)}
etc.

Zapier dynamic dropdown on condition

I'm updating a Zapier APP through the Web builder. I need to add two fields:
The label of the first is "Vat Description", and is a text input field;
The second is "Vat Nature", a dropdown list.
I want to make this field required only if the value of the first is 0, or 0%
Any suggestions? thanks
David here, from the Zapier Platform team.
This is pretty straightforward to do. You want to put the second field in a function, which will generate it dynamically based on the contents of the first field. You can adjust whether or not it's required.
There's docs about this here.

SmartGWT: Checkbox Tree - the proper way to get selected checkbox value

SmartGWT has this property for a TreeGrid object:
employeeTreeGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
This by default 'prepends' every nodes (including root) with checkbox.
(Just making myself clear.)
Also, I am aware of this similar solved question:
GWT tree with checkbox:How to get all checked tree items?
However, I do not seek this kind of solution..
What I'm looking for is a more efficient way, where I don't have to loop through 1000 items.
Is there any way to do this, if possible, using the widget I am using now?
If not, is there any other way, using other widget?
Thank you very much!
I think as you use SelectionAppearance.CHECKBOX you tell to the grid that the selected records are marked by the checkbox field value. So every time you check one you select a record.
You can get the set of selected records by either getSelection() method or getSelectedRecords(boolean) because of deprecation of the previuous one.
You can have a look at the code of this example of the smartgwt showcase.

Grails 'scale' dropping decimal digits

Question using Grails 1.3.4 - the 'scale' constraint does not seem to keep my decimals.
I have a field defined as: Float latitude
I have a constraint: latitude(blank: false, range:-360.0f..360.0f, scale:6)
The Oracle 10g field is defined as: NUMBER(10,6)
When I enter a value in Create or Edit, the correct value gets to the database. However, it never displays correctly in Show. If I enter 10.1234567 and update, 10.123457 is in the database but 10.123 displays in Show.
If I Edit, the value shows as 10.123, and if I update without modifying it, 10.123 will be stored in the database, replacing 10.123457 even though I never touched that field.
If I edit the value to 10.456789, but leave another required field blank, the resulting Edit screen with the error message displays the value as 10.457.
Why is Grails continually rounding the value to 3 digits? I tried the field as a Double as well, but same results. I thought maybe it was Oracle, but I tried it with the default dev database, and same result. I thought maybe it was the 'range', but I took that off with the same result.
Hmm - are you sure it's displaying correctly in your database viewer? Also - check your use of tags: See http://www.pubbs.net/200908/grails/38057-grails-user-how-does-rounding-of-decimals-work-in-gsp.html
Wasted too much time trying to figure this out, ended up using the solution suggested by snowmanjack.
The default data binding that occurs with the fieldValue call is truncating it. You can write a new data binder that handles conversion the way you want as described here http://grails.org/doc/latest/guide/single.html#dataBinding
Or you can do the lazy, probably less safe method that I used and access the property directly.
I replaced.
${fieldValue(bean: countryInstance, field: "latitude")}
with
${contryInstance.latitude}

get a array use params

In rails , I met a question!
when i use the multiple select ,i don't know ,how can i get the all parameter values ,it likes
in javaEE,
String[] strs=request.getParameters("aaa");
so,who can tell me the method in rails to realize the function?
Thank you in advance!
You search for "params". See http://api.rubyonrails.org/classes/ActionController/Base.html#Parameters for reference (subsection #Parameters). You can access the "aaa" parameter (GET/POST) using params[:aaa].
If you have a multi select in your form that value will just be an array of those values.

Resources