:::: MENU ::::

Data is not saving from ui from add new button

Recent QuestionsCategory: Magento 2 QuestionsData is not saving from ui from add new button
Abdus Salam asked 11 months ago

Data is not saving in the table when submitting from UI form in Magento 2 but Magento doesn’t give an error, but data is saving while editing the form.

0 Answers
qaisarsatti Staff answered 11 months ago

hi abdul salam,

this error probably due the primary key hidden field. check if the primary key value is not set then unset the primary key data.

  $primaryKey = $data['primary_id'];

   if(empty($primaryKey)):
     unset($data['primary_id']);
   endif;

Reason: when the primary key is set model try to update the record in table.