Backbone.syphon.deserialize not set the values of nested form fields? - backbone.js

We have a user details form having nested form fields like phoneNumbers[cell][value], phoneNumbers[home][value] etc. When we used syphon.deserialize to push the values, all other form fields like first name, last name etc set the value, but the values are not set in nested form fields. Do we need any other settings for nested form fields? Please suggest a solution.
Thanks in advance

Related

multi-select dropdown and form field shows as array?

I am using ColdFusion 2016. I have a form with a multi-select drop down. The name attribute of the field is called jobRoleId. When I submit this form the field name is available in the form scope as jobRoleId[]. How do I get the value of this field? The name comes across like an array but I can't seem to just dump out the value due to the brackets.
I've tried dumping out the value, but I get an error. I feel like I have done this in the past and the form field name didn't contain the brackets [] after the field name when using a multi select menu:
<select id="jobRoleId" name="jobRoleId" multiple="multiple">...</select>
Is there a way to somehow have the form field name just come across as jobRoleId?
writedump(jobRoleId[]);
abort;
When I execute your code I get a comma separated list for the values of jobRoleId. Are you using any CF frameworks?
My output:
I also suggest looking at the client side JavaScript to confirm there's nothing changing the submitted name. You can use the Chrome/Firefox/IE debugger to watch your submissions and confirm what is being submitted
Multi select lists, in CF, should return a list of values, as far as I remember...

Redux form set custom error message based on field's hinttext in Field Validation

I am trying to write a Field validation so that i don't have to write separate validation in every file. While trying to do it, i am able to get value of the field as well as the whole form fields.
I have to set the error message based on the field name, eg.
For field name as Firstname the error message has to be : First name is invalid.
is there a way to implement this with the Field Validation, or the sync validation is the only way?
Any help will be appreciated.
There is a "hacky" way to do this. Since in field validation you get field value and form values as parameters, you could get field name (which would be the key of the form values object) by searching for a matching value in form values. Then you would need to have a file with field name translations where you could get the field name, e.g. translations[fieldName].
However, since the above way requires more setup and sync validation is relatively simple, I would recommend using sync validation.

registeredFields vs fields

Using redux-form, I created a Wizard where the form is split on multiple components that share the same form name.
When I look into my DevTools, I notice there is only the field of the first page that is "registered".
What is the difference between registeredFields and fields in this context?
fields holds all the meta state information about each of your fields. e.g. touched, active, etc.
registeredFields is the list of all the fields (name and type) that are currently on the page. This is used to only run validation on fields that are on the page.

How to get custom fields list with describeSObject on Salesforce

I am using describeSObject to get the fields list of the object "contact".
However, while I have created some custom fields in the contact object, these custom fields don't appear in the fields list returned when looping on the fields property.
$fields = $mySforceConnection->describeSObject('contact');
foreach($fields->fields as $value){
echo $value->name.' '.$value->label."\r\n";
}
When doing so I get all the default contact object fields, but not the custom fields I created for the object.
I can't find what I am not doing right, any idea?
Thanks in advance for your help.
describeSObject will return all fields (standard & custom) that you have access to, sounds like you might not of given your profile FLS (Field Level Security) access to your new fields.

ExtJS loop through form fields that got a specified name

I'm using ExtJS 3. I have a formPanel with many "cloned" fields and I gave every field the name "price[]". After submit I would like to loop through every field that has the name "price[]" and get their values one at a time to be checked against something in the database.
Note: there are other fields in this form so that's why I need to specify witch items to get from it, by name. I know how to submit the form, I just need to loop through those field and get their values.
How can I do this ?
Thank you!
You can use the find(propName, value) method of FormPanel. It returns an array of all the matches. The matches will be Ext.form.WhateverField objects, depending on what types of input elements your form has, and not raw DOM elements.
var priceFields = myFormPanel.find('name', 'price[]');
The BasicForm object has a property items: it is a mixed collection. You may iterate over the collection.
ExtJS forum

Resources