Set object fields to FormData instance

@param {string} [prefix = undefined] – parent field key
@param {any} value – A value of the current field

@api private
438617
function set(prefix, value) {
    for (const key of keys(value)) {
      const name = prefix ? `${prefix}[${key}]` : key
      const field = value[key]

      if (isArray(field) || isPlainObject(field)) {
        set(name, field)
      } else {
        if (options.strict && (isBoolean(field) && field === false)) {
          continue
        }

        fd[method](name, field)
      }
    }
  }
1082138
protected function setFormData()
    {
        foreach ($this->validFields as $field => $params) {
            if (isset($params["rename"])) {
                $field = $params["rename"];
            }
            if ($params['type'] == "single") {
                if (isset($this->fieldData[$field])) {
                    $this->formData[$field] = $this->fieldData[$field];
                }
            } elseif ($params['type'] == "product") {
                if (!isset($this->formData[$field])) {
                    $this->formData[$field] = array();
                }
                foreach ($this->products as $num => $product) {
                    if (isset($product[$params["paramName"]])) {
                        $this->formData[$field][$num] = $product[$params["paramName"]];
                    }
                }
            }
        }
    }
912480
private static void setFields(final Object from, final Object to,
	                              final Field[] fields, final boolean accessible,
	                              final Map objMap, final Map metadataMap)
	{
		for (int f = 0, fieldsLength = fields.length; f < fieldsLength; ++f)
		{
			final Field field = fields[f];
			final int modifiers = field.getModifiers();
			if ((Modifier.STATIC & modifiers) != 0) continue;
			if ((Modifier.FINAL & modifiers) != 0)
				throw new ObjectCopyException("cannot set final field [" + field.getName() + "] of class [" + from.getClass().getName() + "]");
			if (!accessible && ((Modifier.PUBLIC & modifiers) == 0))
			{
				try
				{
					field.setAccessible(true);
				}
				catch (SecurityException e)
				{
					throw new ObjectCopyException("cannot access field [" + field.getName() + "] of class [" + from.getClass().getName() + "]: " + e.toString(), e);
				}
			}
			try
			{
				cloneAndSetFieldValue(field, from, to, objMap, metadataMap);
			}
			catch (Exception e)
			{
				throw new ObjectCopyException("cannot set field [" + field.getName() + "] of class [" + from.getClass().getName() + "]: " + e.toString(), e);
			}
		}
	}
1315228
function (value, options) {

        // Check the parameters and reassign if needed
        if (typeof value === 'object') {
            options = value;
            value = true;
        }

        var selectHandler = this.remember('_selectHandler') || new SelectHandler(this);

        selectHandler.init(value === undefined ? true : value, options || {});

        return this;

    }
245382
function FormData(options) {
  if (!(this instanceof FormData)) {
    return new FormData();
  }

  this._overheadLength = 0;
  this._valueLength = 0;
  this._valuesToMeasure = [];

  CombinedStream.call(this);

  options = options || {};
  for (var option in options) {
    this[option] = options[option];
  }
}
1299036
function BindedField() {
    var object = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : mandatory("object");
    var property = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : mandatory("property");
    var parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
    var fieldType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "input";
    var allowedValues = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
    var hierarchy = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;

    _classCallCheck(this, BindedField);

    // constant
    var _this4 = _possibleConstructorReturn(this, (BindedField.__proto__ || Object.getPrototypeOf(BindedField)).call(this, object, property, hierarchy));

    _this4.VALID_FIELD_TYPE = ["input", "selector", "slider"];

    // field
    _this4.field = null;
    _this4.fieldType = fieldType;
    _this4.fieldHTML = null;
    _this4.allowedValues = allowedValues;
    _this4.tempClass = "binded-" + (typeof object === "undefined" ? "undefined" : _typeof(object)) + property;

    // parent
    _this4.parent = parent;

    // build the field html
    switch (_this4.fieldType) {
      case "input":
        _this4.fieldHTML = "<fieldset class=\"form-group\">" + "<label>" + property + "</label>" + "<input type=\"text\" class=\"form-control " + _this4.tempClass + "\" data-binded=\"" + property + "\">" + "</fieldset>";
        break;
      case "selector":
        if (!allowedValues) {
          throw new Error("fieldType selector needs at least one allowedValues");
        }

        _this4.fieldHTML = "<fieldset class=\"form-group\">" + "<label>" + property + "</label>" + "<select class=\"form-control " + _this4.tempClass + "\" data-binded=\"" + property + "\">";

        for (var i = 0; i < _this4.allowedValues.length; i++) {
          _this4.fieldHTML = _this4.fieldHTML + "<option value=\"" + _this4.allowedValues[i] + "\">" + _this4.allowedValues[i] + "</option>";
        }
        _this4.fieldHTML = _this4.fieldHTML + "</select></fieldset>";
        break;
      case "slider":
        break;
      default:
        throw new Error("fieldType is invalid : input, selector and slider are the only valid type for now");
    }

    if (parent) {
      _this4.placeInParent();
    }
    return _this4;
  }
1366625
public void setFormValue(Object value) {

        if (value == null) {
            value = "";
        }

        if (value instanceof String) {
            String strValue = (String)value;
            if (strValue.equals("")) {
                // interpret empty string as "no radio button selected"
                reset();
            } else {
                CmsRadioButton button = m_radioButtons.get(value);
                m_group.selectButton(button);
            }
        }
    }
860748
function(val, sendUpdatedEvt) {
      this.value = val;
      
      inputEx.renderVisu(this.options.visu, val, this.fieldContainer);
      
	   inputEx.UneditableField.superclass.setValue.call(this, val, sendUpdatedEvt);
   }
1134661
private function setSubmittedDatasFromPost()
    {
        if (null !== $_POST) {
            // If ajax, check formData parameter
            if (!empty($_SERVER['HTTP_X_REQUESTED_WITH'])
                && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'
            ) {
                $keyValuePairs = explode('&', $_POST['formData']);
                array_walk(
                    $keyValuePairs,
                    function ($value) {
                        list($key, $postValue) = explode('=', $value);
                        $this->submittedData[$key] = urldecode($postValue);
                    }
                );
            } else {
                $this->submittedData = $_POST;
            }
        }
    }
752557
function writeValue(value, fieldSchema) {
        // onBeforeValueSet allows you to cancel the operation.
        // It doesn't work like transform and others that allow you to modify the value because all typecast has already happened.
        // For use-cases where you need to modify the value, you can set a new value in the handler and return false.
        if (this[_privateKey]._options.onBeforeValueSet) {
            if (this[_privateKey]._options.onBeforeValueSet.call(this, value, fieldSchema.name) === false) {
                return;
            }
        }

        // Alias simply copies the value without actually writing it to alias index.
        // Because the value isn't actually set on the alias index, onValueSet isn't fired.
        if (fieldSchema.type === 'alias') {
            this[fieldSchema.index] = value;
            return;
        }

        // Write the value to the inner object.
        this[_privateKey]._obj[fieldSchema.name] = value;

        // onValueSet notifies you after a value has been written.
        if (this[_privateKey]._options.onValueSet) {
            this[_privateKey]._options.onValueSet.call(this, value, fieldSchema.name);
        }
    }
128095
private void set(String fieldName, Object value) {
    try {
      String subField;
      Iterator<String> levels = Splitter.on(".").split(fieldName).iterator();
      GenericRecord toInsert = record;
      subField = levels.next();
      Object subRecord = toInsert;

      while (levels.hasNext()) {
        if (subRecord instanceof GenericRecord) {
          subRecord = ((GenericRecord)subRecord).get(subField);
        } else if (subRecord instanceof List) {
          subRecord = ((List)subRecord).get(Integer.parseInt(subField));
        } else if (subRecord instanceof Map) {
          subRecord = ((Map)subRecord).get(subField);
        }

        if (subRecord == null) {
          throw new FieldDoesNotExistException("Field " + subField + " not found when trying to set " + fieldName);
        }
        subField = levels.next();
      }

      if (!(subRecord instanceof GenericRecord)) {
        throw new IllegalArgumentException("Field " + fieldName + " does not refer to a record type.");
      }

      toInsert = (GenericRecord)subRecord;
      Object oldValue = toInsert.get(subField);

      toInsert.put(subField, value);

      Schema.Field changedField = toInsert.getSchema().getField(subField);
      GenericData genericData = GenericData.get();

      boolean valid = genericData
          .validate(changedField.schema(), genericData.getField(toInsert, changedField.name(), changedField.pos()));
      if (!valid) {
        toInsert.put(subField, oldValue);
        throw new IncorrectTypeException(
            "Incorrect type - can't insert a " + value.getClass().getCanonicalName() + " into an Avro record of type "
                + changedField.schema().getType().toString());
      }
    } catch (AvroRuntimeException e) {
      throw new FieldDoesNotExistException("Field not found setting name " + fieldName, e);
    }
  }
466270
private function setObjectValue(&$object, FieldDefinition $fieldDefinition, $value): void
    {
        //using setter
        $accessor = new PropertyAccessor();
        $propertyName = $fieldDefinition->getOriginName();
        if (\is_array($object)) {
            $object[$propertyName ?? $fieldDefinition->getName()] = $value;
        } else {
            if ($accessor->isWritable($object, $propertyName)) {
                $accessor->setValue($object, $propertyName, $value);
            } else {
                //using reflection
                $refClass = new \ReflectionClass(\get_class($object));
                if ($refClass->hasProperty($object) && $property = $refClass->getProperty($object)) {
                    $property->setAccessible(true);
                    $property->setValue($object, $value);
                }
            }
        }
    }
81092
def setFieldValue( fieldName, fieldValue, dbid = nil, rid = nil, key =nil )
      @dbid ||= dbid
      @rid ||= rid
      @key ||= key
      if @dbid and (@rid or @key)
         clearFieldValuePairList
         addFieldValuePair( fieldName, nil, nil, fieldValue )
         editRecord( @dbid, @rid, @fvlist, nil, nil, nil, nil, nil, @key )
      end
   end
147997
function(data, prefix) {
  prefix = prefix || '';
  var row = Object.keys(data).map(function(key) {
    if (typeof data[key] !== 'object') {
      return util.format('%s%s="%s"', prefix, key, data[key]);
    }
    // Flatten this nested object.
    return _reformat(data[key], key + '.');
  });
  return row.join(' ');
}
818475
public Object prepare(final Object value) {
        if (value == null || value instanceof String || !stringify) {
            return value;
        } else {
            if (value instanceof Boolean) {
                return PREFIX_BOOLEAN.concat(value.toString());
            } else if (value instanceof Integer) {
                return PREFIX_INT.concat(value.toString());
            } else if (value instanceof Long) {
                return PREFIX_LONG.concat(value.toString());
            } else if (value instanceof Date) {
                return PREFIX_DATE.concat(newSdf().format((Date) value));
            } else if (value instanceof URI) {
                return PREFIX_URI.concat(value.toString());
            } else {
                return PREFIX_SB64.concat(serializationHelper.serializeToBase64((Serializable) value));
            }
        }
    }
403774
function( option, value ) {
            var curr = this.data( dataName ).options || {},
                prev = $.extend( {}, curr );

            if ( typeof option === "string" && option[ 0 ] !== "_" ) {
                if ( value === undefined ) {
                    return curr[ option ];
                } else {
                    curr[ option ] = value;
                    updateOptions( this, prev, curr );

                    return this;
                }
            } else if ( $.isPlainObject( option ) ) {
                $.extend( curr, option );
                updateOptions( this, prev, curr );

                this.data( dataName ).options = curr;
            }

            return curr;
        }
588679
function (values, schema, options, callback) {
    var newValues = {}
        , errors = []
        , modelList = find(schema)
        , val;

    for (var model in modelList) {
        if (_.isArray(modelList[model])) {

            if (values === undefined) {
                val = undefined;
            }
            else {
                val = values[model];
            }

            // Empty array defined in schema
            if (_.isEmpty(modelList[model])) {
                if (val) {
                    newValues[model] = val;
                }
            }
            else {
                // Set value to empty array if empty given
                if (val == undefined) {
                    if (options && options.partial == true) {
                        // Do nothing
                    }
                    else {
                        newValues[model] = [];
                    }
                }
                else {
                    // Sub model defined in schema
                    for (var thisSubSchema in modelList[model]) {
                        if (_.isArray(val)) {
                            for (var thisValue in val) {

                                // Check if type array or plain array
                                if (typeof val[thisValue] == "object") {
                                    modelCompare(val[thisValue], modelList[model][thisSubSchema], options, function (err, data) {
                                        if (err) {
                                            errors = _.union(errors, err);
                                        }
                                        if (data !== null) {
                                            if (!newValues[model]) {
                                                newValues[model] = [];
                                            }
                                            newValues[model][thisValue] = data;
                                        }
                                    });
                                }
                                else {
                                    rulesMatch(thisValue, val[thisValue], modelList[model][thisSubSchema], options, function (err, data) {
                                        if (err) {
                                            errors.push(err);
                                        }
                                        if (data !== undefined) {
                                            if (!newValues[model]) {
                                                newValues[model] = [];
                                            }
                                            newValues[model][thisValue] = data;
                                        }
                                    });
                                }
                            }
                        }
                        else {
                            modelCompare(val, modelList[model][thisSubSchema], options, function (err, data) {
                                if (err) {
                                    errors = _.union(errors, err);
                                }
                                if (data !== null) {
                                    newValues[model] = data;
                                }
                            });
                        }
                    }
                }
            }
        } else {
            // Check for definition of {} in model to allow any data for this node without validation
            if (_.isEmpty(modelList[model])) {
                for (var index in values) {
                    var filter = new RegExp("^" + model);
                    if (index.match(filter)) {
                        newValues[index] = values[index];
                    }
                }
            }
            else {
                if (values === undefined) {
                    val = undefined;
                }
                else {
                    val = values[model];
                }

                rulesMatch(model, val, modelList[model], options, function (err, data) {
                    if (err) {
                        errors.push(err);
                    }
                    if (data !== undefined) {
                        newValues[model] = data;
                    }
                });
            }
        }
    }

    if (_.isEmpty(errors)) {
        errors = null;
    }
    else {
        errors = {name: 'ValidationError', err: errors};
    }
    if (_.isEmpty(newValues)) {
        newValues = null;
    }
    callback(errors, newValues);
}