Skip to content

Commit

Permalink
fix: Render hidden input with value
Browse files Browse the repository at this point in the history
  • Loading branch information
davidchin committed Jan 30, 2017
1 parent e8ff397 commit 57c44f8
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/js/input-range/input-range.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,10 @@ export default class InputRange extends React.Component {
* @return {string[]} Array of HTML
*/
renderSliders() {
const keys = this.getKeys();
const values = valueTransformer.valuesFromProps(this.props, this.isMultiValue());
const percentages = valueTransformer.percentagesFromValues(values, this.props.minValue, this.props.maxValue);

return keys.map((key) => {
return this.getKeys().map((key) => {
const value = values[key];
const percentage = percentages[key];
const ref = `slider${captialize(key)}Node`;
Expand Down Expand Up @@ -548,16 +547,22 @@ export default class InputRange extends React.Component {

/**
* Get an array of hidden input HTML for rendering
* @return {string[]} Array of HTML
* @return {?string[]} Array of HTML
*/
renderHiddenInputs() {
const keys = this.getKeys();
if (!this.props.name) {
return;
}

return keys.map((key) => {
const name = this.isMultiValue() ? `${this.props.name}${captialize(key)}` : this.props.name;
const isMultiValue = this.isMultiValue();
const values = valueTransformer.valuesFromProps(this.props, isMultiValue);

return this.getKeys().map((key) => {
const value = values[key];
const name = isMultiValue ? `${this.props.name}${captialize(key)}` : this.props.name;

return (
<input key={key} type="hidden" name={name} />
<input key={key} type="hidden" name={name} value={value} />
);
});
}
Expand Down

0 comments on commit 57c44f8

Please sign in to comment.