Drop-Down list custom entry


I’m creating a new Drop Down menu using a custom fields. I created the custom field on the gui and called it Mes_Cierre

I added an entry on the application/modules/quotes/views/view.php file to display such drop down.

<!-- Aqui es para poner el mes de cierre del proyecto forecast --!>

                                <div class="quote-properties">
                                    <label for="custom[quote_custom_mes_cierre]">
                                        <?php echo "Cierre Estimado"; ?>
                                    <select name="custom[quote_custom_mes_cierre]" id="quote_custom_mes_cierre"
                                            class="form-control input-sm">
                                        <?php $colors = array("red", "green", "blue", "yellow", "orange"); ?>
                                        <?php   foreach ($colors as $value) { ?>
                                                <option value="<?php echo $quote->quote_custom_mes_cierre; ?>"
                                                    <?php if ($value == $quote->quote_custom_mes_cierre) { ?>selected="selected"<?php } ?>>
                                                <?php echo $value; ?>
                                        <?php           } ?>

<!-- Fin de codigo de forecast --!>

It is a simple drop down and it does work, if I pre-fill the custom value to an option from the menu, it pre-selects that option.

The problem: If I can change the value using the drop down menu but it’s not saved on the database once I click the save button.

Under the $(’#btn_save_quote’).click(function () { I added a line just like the quote_id to try to save it:

quote_custom_mes_cierre: $(‘custom[quote_custom_mes_cierre’).val(),

But it does not work. I even excluded the custom item from being shown on the webpage by adding an if option.

<?php foreach ($custom_fields as $custom_field) { ?>
           <?php if ($custom_field->custom_field_label != "Mes_Cierre") { ?>

Does any one has created something like this? or does have any idea how can I save the input on the database.


Sorry to replay to my own post, but i found that the problem was that I did’t define the value option inside <option value="<?php echo $quote->quote_custom_mes_cierre; ?>". Once I added a variable it works and save the data properly.