edit_data and new_data only work if you have a variable of type "key" defined, i.e. if you use ad_form's ability to manage integer keys allocated by sequence, by default the object sequence. If you aren't working with data structured this way use the on_submit clause instead and provide your own logic to differentiate new from edit submits.