Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

How to connect forms in reactjs

$
0
0

im a student trying to learn react , type script .And im having some problems in forms.So here is how my site is looking : !(https://ibb.co/QCkkVY9)

So i have created a crud that has , name , username , number , street , country and city , payment form etc.

one form has 8 attributes : https://ibb.co/TmFt1F2

other forms have other attributes : https://ibb.co/ZL9LLDy

So i have created this method to create an object :

const initializeForm = () => { return { id: "", emri: "", mbiemri: "", nrTelefonit: "", nrTelefonit2: "", adrersa: "", adresa2: "", qyteti: "", shteti: "", menyraTransportit: "", opsioniFaturimit: "" }; };

const [adresa, setAdresaF] = useState<IAdresaF>(initializeForm);

But when i sbumit it says that the forms are not connectedCan someone explain to me how to connect forms

const handleSubmit = () =>{ console.log(adresa); } image : (https://ibb.co/9t98CL8)

`<Segment basic><h3 style={{ marginTop: "10px" }}>Adresa e faturimit</h3><Form><label>Emri</label><Form.Input              onChange={handleInputChange}              name="emri"              placeholder=""              value={adresa.emri}            /><label>Mbiemri</label><Form.Input              onChange={handleInputChange}              name="mbiemri"              placeholder=""              value={adresa.mbiemri}            />`            `<label>NrTelefonit</label><Form.Input              onChange={handleInputChange}              name="nrTelefonit"              placeholder=""              value={adresa.nrTelefonit}            /><label>NrTelefonit2</label><Form.Input              onChange={handleInputChange}              name="nrTelefonit2"              placeholder=""              value={adresa.nrTelefonit2}            /><label>Adresa</label><Form.Input              onChange={handleInputChange}              name="adrersa"              placeholder=""              value={adresa.adrersa}            /><label>Adresa2(Opsionale)</label><Form.Input              onChange={handleInputChange}              name="adresa2"              placeholder=""              value={adresa.adresa2}            />`            `<label>Qyteti</label><select onChange={handleClickChange} name="qyteti"><option value="Rahovec">Rahovec</option><option value="Pejë">Pejë</option><option value="Prishtinë">Prishtinë</option><option value="Gjakovë">Gjakovë</option><option value="Prizren">Prizren</option><option value="Gjilan">Gjilan</option><option value="Ferizaj">Ferizaj</option><option value="Fushë Kosovë">Fushë Kosovë</option><option value="Viti">Viti</option><option value="Klinë">Klinë</option><option value="Mitrovicë">Mitrovicë</option><option value="Deçan">Deçan</option><option value="Istog">Istog</option><option value="Malishevë">Malishevë</option><option value="Zveqan">Zveqan</option></select><label>Shteti</label><Dropdown                placeholder="Select Country"                onChange={handleShtetiChange}                fluid                search                selection                options={countryOptions}                value={adresa.shteti}              />`        `  <Segment basic><Button              fluid              onClick={()=>{                clickVazhdo();                handleSubmit();              }}              content="Vazhdo"              textalign="center"              color="orange"            /></Segment></Form></Segment>  );};`

This is the code to my form , why it says form is not connected m and how to connect to other formsenter code here


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>