{"action":"created","issue":{"url":"https://api.github.com/repos/oscarotero/form-manager/issues/42","labels_url":"https://api.github.com/repos/oscarotero/form-manager/issues/42/labels{/name}","comments_url":"https://api.github.com/repos/oscarotero/form-manager/issues/42/comments","events_url":"https://api.github.com/repos/oscarotero/form-manager/issues/42/events","html_url":"https://github.com/oscarotero/form-manager/issues/42","id":67927213,"number":42,"title":"Default values are lost after load call","user":{"login":"eusonlito","id":644551,"avatar_url":"https://avatars.githubusercontent.com/u/644551?v=3","gravatar_id":"","url":"https://api.github.com/users/eusonlito","html_url":"https://github.com/eusonlito","followers_url":"https://api.github.com/users/eusonlito/followers","following_url":"https://api.github.com/users/eusonlito/following{/other_user}","gists_url":"https://api.github.com/users/eusonlito/gists{/gist_id}","starred_url":"https://api.github.com/users/eusonlito/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eusonlito/subscriptions","organizations_url":"https://api.github.com/users/eusonlito/orgs","repos_url":"https://api.github.com/users/eusonlito/repos","events_url":"https://api.github.com/users/eusonlito/events{/privacy}","received_events_url":"https://api.github.com/users/eusonlito/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-12T15:28:38Z","updated_at":"2015-04-12T16:06:50Z","closed_at":null,"body":"I have this definition:\r\n\r\n```php\r\n$form = new FormManager\\Containers\\Form;\r\n\r\n$form->add([\r\n    'action' => F::hidden()->val('edit'),\r\n    'id' => F::hidden()\r\n]);\r\n```\r\n\r\nThen, I load a default value to `id`:\r\n\r\n```php\r\n$form->load(['id' => 1]);\r\n```\r\n\r\nAfter that, I lost `action` value:\r\n\r\n```php\r\nvar_dump($form['action']);\r\n```\r\n\r\n```php\r\nHidden {#183 ▼\r\n  +input: Input {#184 ▼\r\n    #name: \"input\"\r\n    #parent: Form {#180 ▶}\r\n    #close: null\r\n    #attributes: array:2 [▼\r\n      \"type\" => \"hidden\"\r\n      \"value\" => \"\"\r\n    ]\r\n    #data: []\r\n    #vars: []\r\n    #html: null\r\n    #sanitizer: null\r\n    #validators: []\r\n    #error: null\r\n    #key: \"action\"\r\n  }\r\n  #labelPosition: 0\r\n  #render: null\r\n  #rendering: false\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/oscarotero/form-manager/issues/comments/92084003","html_url":"https://github.com/oscarotero/form-manager/issues/42#issuecomment-92084003","issue_url":"https://api.github.com/repos/oscarotero/form-manager/issues/42","id":92084003,"user":{"login":"oscarotero","id":377873,"avatar_url":"https://avatars.githubusercontent.com/u/377873?v=3","gravatar_id":"","url":"https://api.github.com/users/oscarotero","html_url":"https://github.com/oscarotero","followers_url":"https://api.github.com/users/oscarotero/followers","following_url":"https://api.github.com/users/oscarotero/following{/other_user}","gists_url":"https://api.github.com/users/oscarotero/gists{/gist_id}","starred_url":"https://api.github.com/users/oscarotero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oscarotero/subscriptions","organizations_url":"https://api.github.com/users/oscarotero/orgs","repos_url":"https://api.github.com/users/oscarotero/repos","events_url":"https://api.github.com/users/oscarotero/events{/privacy}","received_events_url":"https://api.github.com/users/oscarotero/received_events","type":"User","site_admin":false},"created_at":"2015-04-12T16:06:50Z","updated_at":"2015-04-12T16:06:50Z","body":"This is not an issue, is the way the form must to work. The load method does not merge the old values with the newest. If you want to merge it (for any reason) you can do it by yourself:\r\n```php\r\n$values = $form->val();\r\n$values = array_merge($values, $new_values);\r\n$form->load($values);\r\n```\r\n\r\nBut note that some inputs can have unespected values. For example, with inputs with the attribute `multiple`, collections or collectionMultiple containers, each time you merge the new values, they are appended to older, not replace them."}}