mdb-select - Dropdown ( dosn't transmit value )


Topic: mdb-select - Dropdown ( dosn't transmit value )

DaMaxl premium asked 5 years ago

Hi Guys,

i've a prob by transmitting datas via formular at the mdb-select class.

i'm using this in the form ( this dropdown in created by php in a while loop out of a database) - the class for this dropdown is "mdb-select": [ Option 1 ]:

<div class='md-form mb-0 form-sm'>
  <select type='text' id='componentstyp".$ComponentsID."' name='componentstyp".$ComponentsID."' class='mdb-select md-form' searchable='Search here..'>
          ".$OptionsCompTyp."
  </select>
   <label for='componentstyp".$ComponentsID."' class=''>Components Typ:</label>
</div>

requested on another page is as followed:

    if(isset($_POST["componentstyp$upd_ID"]))
    {
       $upd_ComponentsTyp = $_POST["componentstyp$upd_ID"];
    }
    else
    {
        $upd_ComponentsTyp = 'NotSet';
        $ErrMsg = $ErrMsg . 'No ComponentsTyp, ';
    }

I also tried it in a similar way...also created with php as above BUT just instead of "mdb-select" i use "md-select": [ Option 2 ]:

 <div class='md-form mb-0 form-sm'>
  <select type='text' id='componentstyp".$ComponentsID."' name='componentstyp".$ComponentsID."' class='md-select md-form' searchable='Search here..'>
          ".$OptionsCompTyp."
  </select>
   <label for='componentstyp".$ComponentsID."' class=''>Components Typ:</label>
</div>

and same coding for requesting the values.

[ Option 1 ] : This is NOT working

[ Option 2 ] : This IS working

There are some more fields in this form ( input text, option, textarea,.... )

Textarea, and Input Text is working. The option-field and select-field is not transmitting by using mdb-... BUT with md-...

Do you know why? thnx for a short reply ( and maybe a solution )

BR, Max


Grzegorz Bujański staff commented 5 years ago

Unfortunately not. I have not encountered this problem yet. I would have to see how you are trying to get these values ​​and be able to reproduce it. Can you show the code responsible for retrieving values ​​from not working fields?


DaMaxl premium commented 5 years ago

The code for getting the values is exactly the same!

if(isset($_POST["componentstyp$upd_ID"]))
{
   $upd_ComponentsTyp = $_POST["componentstyp$upd_ID"];
}
else
{
    $upd_ComponentsTyp = 'NotSet';
    $ErrMsg = $ErrMsg . 'No ComponentsTyp, ';
}

the only change is the class of the select item -> md-select instead of mdb-select

with class='md-select' it's working

with class='mdb-select' it's NOT working


DaMaxl premium commented 5 years ago

by checking the fields and values with: foreach($_POST as $key => $val) {

    echo 'Field name : '.$key .', Value : '.$val.'<br>';
    $data[$key] = $val; //Thsi array holds all post data now.

    }

there is no variable found for the field with class='mdb-select' by doing the same with class='md-select' the it will be found


Grzegorz Bujański staff commented 5 years ago

I'm not good at php, but I just checked append more options using java script, get value after selecting an option and everything works as it should.


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Open

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.18.0
  • Device: Laptop
  • Browser: google chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No
Tags