onBeforeSave & onAfterSave issues with Lightbox

After seeing and recreating your code, I believe the problem is the fact that you had set the field _id value as the user’s ID

  $w('#dataset1').setFieldValue('_id', user.id); 

The _id field is a unique system field which cannot be edited. even though you are succeeding in changing the values I believe that this is what causing the problems and if you comment-out that line, onAfterSave will work fine.
I suggest inserting the user’s id in a different field in your item schema.

All the Best

  • Lior