Page 1 of 1

Saving a file object

Posted: Mon Apr 29, 2013 3:38 pm
by alextouch
Hi

I have a subform where there are a description text field and a file object, on each row.
I need to allow saving record only if:
- both the description field and the file object are already populated (e.g. if I update a description field on a row already saved);
or
- the description field is populated and a file is selected for upload (e.g. if I add a new row on the subform);
or
- both the description field and the file object are blank (e.g. if the subform is empty).

In other words, I need to apply a filter that doesn't permit to save a record if there is the description field populated while no file is added for upload.

But I don't know how to check if a file object is left blank or not, or if there is a file already uploaded into the database for each row.

Please can someone help me?

Thank you
Alex

Re: Saving a file object

Posted: Mon Apr 29, 2013 4:29 pm
by massiws
Alex,
you can do it with JavaScript: in Custom Code > Javascript tab you have to use nuBeforeSave() function: http://wiki.nubuilder.com/tiki-index.ph ... eforeSave_
If this function return false the record isn't saved.

Hope this helps,
Max

Re: Saving a file object

Posted: Mon May 27, 2013 7:46 am
by admin
.