How to check fieldname in custom validation?

I have 3 email fields and 3 checkboxes associated with them. If a checkbox is ticked then the corresponding email field cannot be blank. I want to create a single validation function called ‘CheckEmails’ that is called from the checkboxes via validate:‘CheckEmails’.

How can I find out which of the 3 checkboxes the validation is being called from so that I can check the associated email field?

Otherwise I have duplicate redundant code because I have to create 3 nearly identical validation functions. One per checkbox.

Please can you advise.

Thanks

Purvez

Could you please provide us completed demo on support@dhtmlx.com - we will try to suggest you something according to the logic of your app.
docs.dhtmlx.com/doku.php?id=othe … leted_demo

And add a link to this topic in that letter, please

Hi Darya

My problem would be solved if when calling the validation function the fieldname was passed along with the value of the field. That is the change that is required here.

Thanks

Go to this link and download fixed form files in attachments - they must help you to solve your issue.

Hi Darya

Thanks for your quick response. I can’t see a link on your post. Please can you check for me.

Purvez

Sorry, something happened…
viewtopic.php?f=17&t=34845

Hi Darya

I’m currently on ver 3.0 of the full pro suite. I know the most recent version is 3.6 so I’m concerned whether there will be some compatibility issues if I use the files in your link.

Please can you advise whether it is safe to use these files with ver 3.0

Thanks again for your help.

Purvez

Yes, you can try to replace these files, but we recommend you to send us your for.js files on support@dhtmlx.com - we will add a fix in your files ans send you back.

Check your mail - we’ve send you updated files.

Hi Darya

It’s been about an hour since you posted the last message. However your email hasn’t arrived.

Please can you check at your end.

Thanks
Purvez

Tried again - please check )