Skip to content
New issue

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

Form component ends in Loader #233

Open
noonation opened this issue Jan 1, 2025 · 0 comments
Open

Form component ends in Loader #233

noonation opened this issue Jan 1, 2025 · 0 comments

Comments

@noonation
Copy link

noonation commented Jan 1, 2025

I don't understand where the Loader is being invoked or what the logic of it is:
The code below is close to verbatim from the Example in the components doc.
Screenshot 2025-01-01 at 8 33 27 AM

The Loader apparently comes after the submitForm(controlValues) inside handleFormData

import React, { useState } from 'react';
import Form from '@mapbox/mr-ui/form';
import FormSubmit from '@mapbox/mr-ui/form-submit';
import ControlText from '@mapbox/mr-ui/control-text';
// import validateRequired from '@mapbox/mr-ui/validators/validate-required';

function validateNoOp(value) {
console.log('val', value);
return '';
}
const formConfig = {
name: {
label: 'Search term',
placeholder: 'Text to match in profiles',
validator: validateNoOp, // validateRequired('Your name'),
},
};

const InputForm = (props) => {
const renderForm = (getControlProps, onSubmit) => {
return (
<>


<ControlText {...getControlProps('name')} />




</>
);
};

const submitForm = (values) => {
console.log('sub', values);
if (props.onSubmit) props.onSubmit(values);
};

const handleFormData = (controlValues) => {
console.log('handle', controlValues);
submitForm(controlValues);
return controlValues;
};

return (


);
};
export default InputForm;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant