We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
the following works, but I had to use select={[k]} instead of select={k}, though the keyPath function accepts numbers
select={[k]}
select={k}
keyPath
export default function keyPath(value) { ... } else if (typeof value === 'number') { return [value]; } else { ... }
it never reaches there because a 0 (number) value fails the below check. Does it suppose to allow numeric index?
Component.js -- get formValue() { if (select && select !== true) { .. }
'use strict'; import React from 'react'; import {Field, Fieldset, Value} from 'react-forms'; class IndividualFieldset extends Fieldset { static schema = { type: 'object', properties: { firstName: {type: 'string'}, lastName: {type: 'string'} } } static value = { firstName: 'John', lastName: 'Doe' } render() { let {label, ...props} = this.props; return ( <div {...props}> <label>{label}</label> <Field select="firstName" label="First name" /> <Field select="lastName" label="Last name" /> </div> ); } } let schema = { type: 'array', items: IndividualFieldset.schema }; let value = [IndividualFieldset.value, { firstName: 'John', lastName: 'Doe' }, { firstName: 'Doe', lastName: 'John' }]; export default class FamilyForm extends React.Component { constructor(props) { super(props); this.state = {formValue: Value(schema, value, this.onChange)}; } onChange = (nextFormValue) => { console.log('form value', nextFormValue.value); this.setState({formValue: nextFormValue}); } render() { let rows = this.state.formValue.value.map( (v, k) => { return <IndividualFieldset select={[k]}/>; }); return ( <Fieldset formValue={this.state.formValue}> {rows} </Fieldset> ); } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
the following works, but I had to use
select={[k]}
instead ofselect={k}
, though thekeyPath
function accepts numbersit never reaches there because a 0 (number) value fails the below check. Does it suppose to allow numeric index?
The text was updated successfully, but these errors were encountered: