nette / forms

📝 Generating, validating and processing secure forms in PHP. Handy API, fully customizable, server & client side validation and mature design.

Home Page:https://doc.nette.org/forms

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FR: Add getChangedValues() method

milo opened this issue · comments

Can be useful to receive only updated values from form/container. For example:

$diff = $form->getUpdatedValues();
if (count($diff)) {
   $db->update(...);
} else {
   $this->flash('Nothing changed.');
}

# or
$this->log("User $username:", $form->getUpdatedValues());

API changes from top of my head:

  • FormContainer::getChangedValues()
  • BaseControl::setAlwaysChanged(bool ...)

Hard to decide in which point create an original values snapshot. Probably exactly before Form::getHttpData().