Archive for February, 2012

jQuery: Problem with hidden selectbox

I use the jQuery SelectBox Plugin for a select box in a hidden DIV container. The problem was that after removing the hidden CSS class from the container, the jQuery SelectBox was empty. I thought that maybe it is in correlation with this statement from A Beautiful Site:

Since the original controls aren’t destroyed (they’re hidden), you can easily integrate this plugin into just about any existing form.

so the only way to get the SelectBox filled correctly was to first destroy  and then reinitialize it (see the code snippet below).

<style>

.hidden {
  display: none;
}

</style>

<script>
$(document).ready(function() {

  $('#show').bind("click", function(){

     $('#container').removeClass('hidden');
     $("#container select").selectBox('destroy');
     $("#container select").selectBox();

  });

  $("select").selectBox();

});
</script>

<a id="show" href="#">show</a>

<div id="container" class="hidden">
  <select>...</select>
</div>

Symfony 1.4: symfony generator Invalid column name ‘id’

It seems that the symfony generator needs a primary key. If there’s no PK defined the generator throws the following exception:

symfony generator Invalid column name ‘id’

In some blog post they solved the problem by adding a primary key to the concerning table. But in my case the DB isn’t under my control, so I found out that it is enough to set the primary key only in the schema.

For instance:

my_table:
  connection: doctrine
  tableName: MyTable
  columns:
    id:
      type: int(11)
      primary: true  # <-- SET TO true

Copyright © 2007-2012 iTopia. All rights reserved.
Jarrah theme by Templates Next | Powered by WordPress