Page 1 of 1

How to create rules on attachments

Posted: 18 Mar 2015
by Jdubs
How do you check if Attachment field is null?

I tried manipulating various attributes of the code you provided here, but nothing worked:

viewtopic.php?f=4&t=132
viewtopic.php?f=1&t=405

Re: How to create rules on attachments

Posted: 19 Mar 2015
by Dmitry Kozlov
Hi,

This code works perfectly for me:

Code: Select all

fd.onsubmit(function() {
	if ($('#idAttachmentsTable tr').length == 0) {
		alert('Please, add an attachment.');
		return false;
	}
	
	return true;
});
Please, make sure that you don't have JS errors or notifications in the browser console.

Re: How to create rules on attachments

Posted: 19 Mar 2015
by Jdubs
Hmm. That worked for me.

I specifically used the the .length == 0 line of code and didn't trigger any console errors. Must have been a conditional error I kept overlooking.


Thanks so much!