I'm using jquery autocomplete, link . But I'm having the following problem:
In the first line of select you would like the famous "Escolha abaixo uma opção"
<option value="">Escolha abaixo uma opção</option>
Or, in the case of edit, select value coming from the bank.
But nothing I do works. Only one blank line appears.
Note: Self-cranking is normal. The select normal population with the data coming from the bank. The problem is just the first line of the select.
I created the script below that technically should fill the first line of the select.
$stringClientes = "";
if($Clientes == null) {
$stringClientes .= "<option value=''>Ainda não existe Cliente cadastrado</option>";
}
else {
$ClienteCadastro = $ClientesDao->pesquisaClienteEdicao($_GET["idClienteCadastro"]);
if(isset($_GET["idClienteCadastro"]) && $ClienteCadastro != null) {
$stringClientes .= "<option value='".$ClienteCadastro->getIdClientes()."'>".$ClienteCadastro->getNome()."</option>";
} else {
$stringClientes .= '<option value="">Escolha um cliente abaixo</option>';
}
foreach ($Clientes as $cliente) {
$stringClientes .= "<option value='".$cliente->getIdClientes()."'>".$cliente->getNome()."</option>";
}
}
And, do not select
<div>
<label>Cliente</label>
<select name="cliente" id="cliente" required>
<option value="" selected>Selecione</option>
<?php echo $stringClientes; ?>
</select><br /> <br />
</div>
On time. The variable, $stringClientes
, correctly selects all options, including the first line. But it seems that autocomplete does not allow us to put text in the combobox.
The complete return of the select goes like this:
<select name="cliente" id="cliente" required>
<option value="" selected>Selecione</option>
<option value='17'>José das couves</option>
<option value='14'>Fulano de Tal</option>
<option value='15'>tal fulano</option>
<option value='16'>Antônio Bandeiras</option>
<option value='17'>José das couves</option>
</select>
But the first line: <option value="" selected>Selecione</option>
does not quit!
In this case, I thought of type['text']
being popular with the value "" or what comes from the bank. How to fill this type['text']
that is only in the plugin?