Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Saving a file object

Locked
alextouch
Posts: 38
Joined: Tue Jun 05, 2012 2:40 pm
Location: Bologna, Italy
Contact:

Saving a file object

Unread post 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
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Saving a file object

Unread post 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
admin
Site Admin
Posts: 2791
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 4 times

Re: Saving a file object

Unread post by admin »

.
Locked