Getting values from form into table (joomla)

1.4k views Asked by At

I am learning Joomla! and I am building my first component.
My problem is now that I have a form that needs to store data in the db.
All is working right up until that point. The table that my form is using is not getting any values. So all that is ever saved is NULL values.

How do I get the values from the form fields into my table?

I am using Joomla 3.2

This is the error I keep getting

Save failed with the following error: SQL=INSERT INTO `test_redbiz_note` () VALUES ()

code:

controller

table

form

model

1

There are 1 answers

0
Jim On BEST ANSWER

So I found a solution.

I still cant get joomla to get the form values to the table so I have to do it myself by overwriting save() in my controller.

   public function save()
   {
        $table = $this->getModel()->getTable();
        $jinput = JFactory::getApplication()->input;
        $JinputFilteredData = $jinput->POST->get('jform','','array');
        $values = $JinputFilteredData["GroupOfFields"];
        $table->bind($values);
        $table->store();
        return;
    }

This does not seem to be the best solution though...