Jump to content

Field default value from GET method

get value default

  • Please log in to reply
3 replies to this topic

#1 jopacic



  • Members
  • Pip
  • 2 posts

Posted 15 June 2013 - 02:46 PM

Link to my page where grocery CRUD instance is, for example 



When I add a new user, URL of the form is 


, and I use link from external page, that points directly to 


 to add new user without displaying the CRUD table first.


Now, I would like to set some default value via GET, for example 


, and set some field's default value to bar if $_GET['foo'] is set.


How can I achieve this?

#2 davidoster


    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 15 June 2013 - 03:04 PM

Hello and welcome to the forums.

You can achieve it either by using getState and before calling the $this->_example_output($output);

make an array($output) of uri data and pass it to the $this->load->view('yourview.php',$output);


The other way is to make it straight way by changing the add.php under assets/grocery_crud/themes/your_theme/views

and there use similar code (uri data).



rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---



David Oster aka George Pasparakis,

#3 jopacic



  • Members
  • Pip
  • 2 posts

Posted 15 June 2013 - 03:35 PM

Hey, thanks for your welcome!


I think I will go the 1st way, but I'm not really sure I got you - can you point me to and example?


I didn't catch the point on how can I extract my GET key/value pairs using getState method?

#4 goFrendiAsgard


    Advanced Member

  • Members
  • PipPipPip
  • 137 posts

Posted 16 June 2013 - 02:15 AM


if($crud->getState() == 'add'){
    $foo = $this->input->get('foo');

No-CMS homepage : http://www.getnocms.com
No-CMS forum : http://www.getnocms.com/forum
No-CMS Github page : https://github.com/g...diAsgard/No-CMS


Please don't mix up No-CMS and groceryCRUD issues.
(eg: user authentication etc is No-CMS specific issue and has nothing to do with groceryCRUD)


Also tagged with one or more of these keywords: get, value, default

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users