I’m using <autocomplete>
as input field, I’m trying to log the values in my console to see if my submit method is working. Currently, I’m not able to submit anything, only empty data to my axios instance and not getting any Traceback errors to work with. My backend works fine, just struggling to send over the data
from my form.
And I’m only trying send over the symbol
from inputted values field to my backend,
const inputOptions = [
{ symbol: "ACN", company: "Accenture Plc", sector: "Technology Services"}
];
Check out my reproducible code:
https://codesandbox.io/s/dazzling-lake-jvdyf?file=/src/App.js
{Without the axios instance}
Form:
<div className={classes.container}>
<Grid>
<form noValidate onSubmit = { handleSubmit(onSubmit) }>
<Controller
render={({ onChange ,...props }) => (
<Autocomplete
{...props}
className={classes.inputBar}
id="stock_list"
name="stock_list"
multiple
options={inputOptions.companies}
filterOptions={filterOptions}
filterSelectedOptions
defaultValue={[]}
onChange={(e, data) => onChange(data)}
getOptionLabel={(option) => option.symbol}
getOptionSelected={(option, value) => option.symbol === value.symbol}
renderOption={(option) =>
{
return (
<>
<span style={{ fontWeight: 500, fontSize: "20px", paddingRight: "1rem" }}>{option.symbol}</span><span style={{ color: "#C6C6C6", fontSize: "24px" }}> | </span><span style={{ paddingLeft: "1rem" }}>{option.company}</span>
</>
)
}}
renderInput={(params) => (
<TextField
{...params}
style={{ alignItems: 'center' }}
id="stock_list"
name="stock_list"
variant="outlined"
label="Companies"
className={classes.inputBar}
/>
)}
/>
)}
name="stock_list"
control={control}
defaultValue={[]}
onChange={([, data]) => data}
/>
<Button
variant="contained"
color="primary"
onClick={handleSubmit}
>
Add Stocks
</Button>
</form>
</Grid>
</div>
I need to send the symbol
values from the multi-input form above to my axios instance.
It’s been proven difficult to do so with a react-hook-form
and Material UI.
EDIT: I’m trying to extract the values from the input field, thanks to the comments I’m able to log to see what values of JSON are selected, but the form is not properly linked yet for submitting data as it seems im sending over an empty dictionary to my backend.
Here is my axios instance.
const onSubmit = (data, e) =>
{
console.log(data);
axiosInstance
.patch(url+ slug + '/', {
stock_list: data.symbol,
})
.then((res) =>
{
console.log(res);
console.log(res.data);
});
};
stromectol tablets for humans for sale – stromectol 2mg ivermectin 1
clomid tablets – where can i buy clomiphene buy clomid online
viagra online in india – how to get viagra in mexico sildenafil 50mg pills
non prescription ed pills – best ed medications non prescription ed drugs
brand cialis 100mg – Best price cialis purchase cialis with paypal
doxycycline 60 mg – doxycycline 75 mg tab doxycycline 100mg price south africa
cialis fast delivery uk – discount pharmacy online generic cialis 2.5 mg online
accutane for sale online uk – cost of accutane canada accutane price in south africa
prednisone brand name – 6 prednisone prednisone 25g
ivermectin brand – ivermectin for sale online ivermectin price comparison
vardenafil online us pharmacy – levitra pills generic ed drugs
buy hydroxychloroquine online – predinson prescriptions how much is prednisone
prednisone 0.5 mg – predinson prescriptions prednisone 500 mg
casinos online – site casino games online
buy accutane pills online – isotretinoin online 120 mg accutane daily
order sildalis pills – propecia 1mg pill cost metformin
purchase ampicillin – purchase ampicillin generic hydroxychloroquine pills
buy hydroxychloroquine 200mg generic – order plaquenil 400mg pill order plaquenil 200mg sale
viagra 25mg generique en pharmacie – vrai tadalafil 5mg prix tadalafil 40mg generique
tadalafil daily online tadalafil cialis
where to buy generic cialis online safely tadalafil dosage
best price usa tadalafil generic cialis tadalafil
cheap cialis pills for sale tadalafil goodrx
tadalafil generic where to buy where to buy cialis without prescription
prescription tadalafil online buy cialis pills
cheap generic cialis for sale cialis without prescription
canada generic tadalafil tadalafil daily online
buy cialis pills buy tadalafil
generic tadalafil from uk tadalafil cost in canada
http://www.ivermectinoge.com/ stromectol 3mg tablets