⚠ 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

How to add my own class name on form fields



Vikas Jha
  • profile picture
  • Member

Posted 14 March 2017 - 06:52 AM

How to add my own class name on form fields like textbox,textarea, and dropdown by default its giving class="form-control" I wwant to add one more class with form-control class


Amit Shah
  • profile picture
  • Member

Posted 14 March 2017 - 09:31 AM

Well. there sre 2 ways to this...

1 .. if you gona have it set on all the pages / forms, it will be wise to alter the themes view file.

2. if u dont wana mingle around the same, you can set it in javascript for the same - for each form elements of a form, add the class that you want to. 

 

the second option is preferred option to .. as you not messing the core code ... best - add the code to a javascript and add it in the crud.php  so its available all across

 

Happy GCing :)


Vikas Jha
  • profile picture
  • Member

Posted 14 March 2017 - 10:01 AM

Well. there sre 2 ways to this...

1 .. if you gona have it set on all the pages / forms, it will be wise to alter the themes view file.

2. if u dont wana mingle around the same, you can set it in javascript for the same - for each form elements of a form, add the class that you want to. 

 

the second option is preferred option to .. as you not messing the core code ... best - add the code to a javascript and add it in the crud.php  so its available all across

 

Happy GCing :)

As I am new in grocery crud can you pls suggest me where is crud.php and how to add class using javascript pls put example


Amit Shah
  • profile picture
  • Member

Posted 14 March 2017 - 12:01 PM

well.. crud.php - i am refering to the view file / part .. in reference with the examples shared. If u using different view file - u can use the same. There - u just need to add the script url of the JS that you created like.

 

Happy GCing :)