0
These are my two inputs:
<div class="span3">
<label for="cor11">CROMIA<span class="required"></span></label>
<select class="span12" name="cor11" id="cor11" onchange="validarForm()" value="">
<option <?php if($result->cor11 == 'Selecione a Cor'){echo 'selected';} ?> value="Selecione a Cor">Selecione a Cor</option>
<option <?php if($result->cor11 == '-'){echo 'selected';} ?> value="-">-</option>
<option <?php if($result->cor11 == 'CYAN'){echo 'selected';} ?> value="CYAN">CYAN</option>
<option <?php if($result->cor11 == 'MAGENTA'){echo 'selected';} ?> value="MAGENTA">MAGENTA</option>
<option <?php if($result->cor11 == 'YELLOW'){echo 'selected';} ?> value="YELLOW">YELLOW</option>
<option <?php if($result->cor11 == 'BLACK'){echo 'selected';} ?> value="BLACK">BLACK</option>
</select>
</div>
<div class="span3">
<label for="cor12">COR ESPECIAL/PANTONE</label>
<input id="cor12" disabled class="span12" type="text" name="cor12" style="text-transform:uppercase" value="<?php echo $result->cor12 ?>" />
</div>
The input cor12
is disabled by choice made in the input cor11
.
If the choice in cor11
for "-", enables the input of cor12
. Script below:
function validarForm() {
var optionSelect = document.getElementById("cor11").value;
if(optionSelect =="-" ){
document.getElementById("cor12").disabled = false;
}else{
document.getElementById("cor12").disabled = true;
}
}
When I do an edit, it even executes the POST
and saved in the comic.
However, if I go back in editing, and make a change in any field, the information of these two inputs is deleted from the comic.
What happens ?
I tested, but it doesn’t work, because if I need to change (edit) again, I can’t.
– Julio Ricardo
The idea is whether in the cor12 <> Empty field, permace with the content and not delete.
– Julio Ricardo