문제

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

도움이 되었습니까?

해결책

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...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top