Capture action from a form on a button

Asked

Viewed 49 times

0

Good Afternoon I made a normal filter, but in order to be able to format the filter in a more effective way, I want to take the Div Button, but when I do this the button stops working because it is not with the form

How do I keep the button running? Follow the code

 <div id = "filtro">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style disabled>
    

    #filtro {
    border-style:double;
}

#button1 {
    width: 120px;
    position: inherit;
    right: 10px;
    background-color: #e00505;
    font-size: 12px;
    FLOAT: right
}

h4 {
    font-size: 18px;
    border-style: inset;
}

select {
    border: 1px solid #000;
    box-sizing: border-box;
    width: 124px;
    border-radius: 5px;
    height: 25px;
    padding: 3px;
}

section label {
    width: calc(100% / 4);
    color: red;
    text-align: center;
}

section {
    display: flex;
    flex-wrap: wrap;
}
h4/ {
    border-style:double;
}


@media screen and (max-width:768px) {
    section label {
        margin-bottom: 20px;
        width: 100%;
    }
}
</style>
<h4 style="text-align: center;">Personalize o seu Kit de Segurança</h4><br><br>

<form action="#" id="form">

    <section>
        <label>
            <b> Tipo do seu Kit </b><br>
            <select name="speed" id="speed" style=" ">
                <option desable>Selecione</option>
                <option>Residencial</option>
                <option>Comercial</option>
            </select>
        </label>
        <label>
            <b>Qualidade de Seu Kit</b><br>
            <select name="files" id="files" style=" ">
                <option desable> Selecione </option>
                <option value="HD">HD</option>
                <option value="Full HD">Full HD</option>
                <option value="Analógica">Analógica</option>

            </select>
        </label>
        <label>
            <b> Quantidade de Câmeras </b><br>
            <select name="number" id="number" style=" ">
                <option desable> Selecione </option>
                <option>1 Câmera</option>
                <option>2 Câmeras</option>
                <option>3 Câmeras</option>
                <option>4 Câmeras</option>
                <option>5 Câmeras</option>
                <option>6 Câmeras</option>
                <option>7 Câmeras</option>
                <option>8 Câmeras</option>
                <option>9 Câmeras</option>
                <option>10 Câmeras</option>
                <option>11 Câmeras</option>
                <option>12 Câmeras</option>
                <option>13 Câmeras</option>
                <option>14 Câmeras</option>
                <option>15 Câmeras</option>
                <option>16 Câmeras</option>
            </select>
        </label>
        <label>
            <b> Selecione a Marca </b><br>
            <select name="salutation" id="salutation">
                <option desable selected>Selecione</option>
                <option>Intelbras</option>
                <option>Hikvision</option>
                <option>Outras</option>
            </select>
        </label>
    </section>
  
<BR>
    <BR>
   
 
</form>
 
</div>
<br>
<br>
 <button class="kd-filter-button" id="button1">Ver resultados</button>

Taking advantage of the question, if you can show me the best way to make the call of the data I need, which formula I can use in the options?

  • What stops working? Your script? If it’s the script, edit your question and also include your JS

  • In case I did not leave the form fully functional, because I need to get the information together with the platform I use (Tray) which commands I need to use to call the right data.... once I have the information I’ll put the right calls... For now I’m doing the "housing" of the form, and in case I need the button to work without being inside the form, so at the moment it does not have JS nor need because the platform does this work and only need the calls

  • But it works by doing what? What’s not working?

  • Work by filtering with selected options, 1 or more selections

  • Or I need a JS to do that function?

  • You do need...!

  • So could you give me a hand to develop this JS?

  • Cara Java Script is not my area, I understand almost nothing, but sometimes someone with knowledge in this area comes to help you. Unfortunately in that question I don’t have enough knowledge to help you.

Show 3 more comments

1 answer

0


Hello, the problem is that HTML is poorly formatted in general. Try to follow patterns by not mixing HTML with CSS and metatags always in the head.

The button must always be contained in the ; it didn’t work because it was outside. Below your code with the button inside the form, allowing the event of Submit.

I hope it helps

<html>
<head>
<meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
<style disabled>
    

    #filtro {
    border-style:double;
}

#button1 {
    width: 120px;
    position: inherit;
    right: 10px;
    background-color: #e00505;
    font-size: 12px;
    FLOAT: right
}

h4 {
    font-size: 18px;
    border-style: inset;
}

select {
    border: 1px solid #000;
    box-sizing: border-box;
    width: 124px;
    border-radius: 5px;
    height: 25px;
    padding: 3px;
}

section label {
    width: calc(100% / 4);
    color: red;
    text-align: center;
}

section {
    display: flex;
    flex-wrap: wrap;
}
h4/ {
    border-style:double;
}


@media screen and (max-width:768px) {
    section label {
        margin-bottom: 20px;
        width: 100%;
    }
}
</style>
</head>
<body>
<form action="#" id="form">
<div id = "filtro">
<h4 style="text-align: center;">Personalize o seu Kit de Segurança</h4><br><br>
<section>
        <label>
            <b> Tipo do seu Kit </b><br>
            <select name="speed" id="speed" style=" ">
                <option desable>Selecione</option>
                <option>Residencial</option>
                <option>Comercial</option>
            </select>
        </label>
        <label>
            <b>Qualidade de Seu Kit</b><br>
            <select name="files" id="files" style=" ">
                <option desable> Selecione </option>
                <option value="HD">HD</option>
                <option value="Full HD">Full HD</option>
                <option value="Analógica">Analógica</option>

            </select>
        </label>
        <label>
            <b> Quantidade de Câmeras </b><br>
            <select name="number" id="number" style=" ">
                <option desable> Selecione </option>
                <option>1 Câmera</option>
                <option>2 Câmeras</option>
                <option>3 Câmeras</option>
                <option>4 Câmeras</option>
                <option>5 Câmeras</option>
                <option>6 Câmeras</option>
                <option>7 Câmeras</option>
                <option>8 Câmeras</option>
                <option>9 Câmeras</option>
                <option>10 Câmeras</option>
                <option>11 Câmeras</option>
                <option>12 Câmeras</option>
                <option>13 Câmeras</option>
                <option>14 Câmeras</option>
                <option>15 Câmeras</option>
                <option>16 Câmeras</option>
            </select>
        </label>
        <label>
            <b> Selecione a Marca </b><br>
            <select name="salutation" id="salutation">
                <option desable selected>Selecione</option>
                <option>Intelbras</option>
                <option>Hikvision</option>
                <option>Outras</option>
            </select>
        </label>
    </section>
</div>

 <button class="kd-filter-button" id="button1">Ver resultados</button>
 </form>
 </body>
 </html>

  • 1

    Yes, I know it wasn’t working because it was out, but I would need it to work out anyway, because I want to customize the form in a way that the Button ends up disturbing... You know? If I am not mistaken it is possible to do with the <script> tag but I don’t understand enough of it to be able to develop And this mixed with CSS because as I work with Tray after finishing everything I will divide into files and make the calls... but at the moment the important thing is to be functional

Browser other questions tagged

You are not signed in. Login or sign up in order to post.