• Dries's avatar
    · 41914814
    Dries authored
    - Bugfix: just before submitting a node, one could change the content of
      that node to something that would not have passed the preview pages.
    
      Patch by Revar:
    
        "If you uploaded a valid file, and filled out the form right, you will
        get a Submit button.  The problem comes in when you choose a different
        file to upload, and then click Submit.  The filestore_save() function
        cannot do proper validation and handling of the form data, as it only
        returns a list of what node fields to save.  On error, a node entry is
        still created, but with only the nid field set.  The user can't be
        forced to fix their bad entry."
    
        "Add a _form_validate() node hook to process and validate any form
        results.  That way even on Submit, the node code would check the
        validity of the data, and if bad, it could drop you back to the preview
        screen with the current bad data warnings.  Have it return an array of
        errors that can be passed in as $error to the _form() hook.  If it
        returns a null array, then there's no errors, and the submit can go
        through."
    41914814
node.module 34.8 KB