Skip to content

Optional values in save-molecules

Choose a tag to compare
@marcgrue marcgrue released this 28 May 09:06
· 456 commits to master since this release

Often, form submissions have some optional field values. Molecule now allow us to save molecules with both mandatory and optional attributes.

We could for instance have aName, optionalLikes and anAge values from a form submission that we want to save. We can now apply those values directly to a mandatory name attribute, an optional likes$ attribute ($ appended makes it optional) and a mandatory age attribute of a save-molecule and then save it:


We can also, as before, insert the data using an "insert-molecule" as a template:$.age.insert(
  aName, optionalLikes, anAge

It can be a matter of taste if you want to save or insert - but now you can choose :-)