⚠ 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

Adding New Field Types and extra data to the fields



Zalo
  • profile picture
  • Member

Posted 27 February 2013 - 11:12 AM

Hello to you all!

 

First of all... i MUST say it: web-johnny... you are a genius! You have no idea how much I love this library!

 

That been said... I have 2 questions:

 

First: Is there a way (and how should I do it) to include more field types for the field_type function? If so... can that be done without changing the library file?

I also thought about creating another library file (like grocery_crud_extension) defining a function like extra_field_type (ideally with the same parameters as field_type) which would call some pre-defined callback_field depending on the field type you pass.

I would love some feed back about this idea, since I have been using GC for just a little while ('bout a month or so) and maybe there is a better way...

 

Second: It´s possible to add some extra data (html) to a default field? For ex.: You have a field named lastname... on the add/edit page, it has some automatic-attributes (id, etc.). Can you add some extra html attributes? Like a class for example...

I ask this because sometimes you may need to define different css styles for some fields in a form, but not others, or maybe running some js on just some of them.

Maybe there is something like the callback_field that let's you modify the default html instead of overwriting it? (like callback_after_insert but for a field... that would give you the default code...)

 

Thanks in advance!!

 

P.D.: If something sounds off... it's probably because my first language is not English, feel free to ask as many things and times as you need  :P


Zalo
  • profile picture
  • Member

Posted 01 March 2013 - 11:41 AM

Btw... In case I wasn't clear... I would like some help on HOW TO do those things... I am not asking somebody else to do them for me :)

Thanks!