⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

dropdown null value



superdan
  • profile picture
  • Member

Posted 06 August 2013 - 12:56 PM

Hi all,

sorry for my english, im italian.

Here is my question.

 

I have a dropdown with a simple relation. Everything works jus great.

I have this option:

 

select color:

 

                  - blue

                  - red

 

that are the right values in my db

 

i also can dont make a choice in my dropdown color ( its not a strict relation ).

 

 

 

Now i would like to have

 

select color:

                  - none ( that must be equivalent to select nothing in the case before )

                  - blue

                  - red

 

( none is NOT in my db, so it must have a null value when the form wil be submitted)

In this way user will be constricted to make a choice in the dropdown.

 

is that possible?

 

Thank a lor, GC is so beautifull!


superdan
  • profile picture
  • Member

Posted 06 August 2013 - 21:03 PM

Sorry I mean nothing not anything!

davidoster
  • profile picture
  • Member

Posted 07 August 2013 - 05:07 AM

Hello and welcome to the forums [member=superdan].

What if you put a new record on this relation table with nothing (or none) on the description of the color?


superdan
  • profile picture
  • Member

Posted 07 August 2013 - 06:48 AM

hi davidoster,

thank you 4 your welcome, i read lot of your posts, you are really great!

What you say its certainly a solution, but a solution that i dont like very much cause i want to mantain tha value blank in my db instead the value null.

Really i cant override keys and values in a dropdown (or add a value in list)?
It should be very nice to do that.


davidoster
  • profile picture
  • Member

Posted 07 August 2013 - 07:11 AM

Of course you can override! If the set_relation isn't doing the work you want use your own model!

Check here: /topic/1240-auto-generated-field-but-custom-data/#entry6619

 

 

 

P.S. Thank you for your kind words! I am just enhtusiastic about Grocery CRUD cause I really believe that it is brilliant!


superdan
  • profile picture
  • Member

Posted 07 August 2013 - 11:08 AM

so you think i can add a fake none value ( null ) creating a new model?
Thanks again