Settings Mail values via JS

Support forumSettings Mail values via JS
Chandra asked 6 years ago
Hi Nikola, I am trying to set some mail content via jQuery. Interestingly, some work like ea_settings['submit.redirect'] = ''; // or give any value but when I try  ea_settings['mail.pending'] = 'so and so'; It doesn't work. I do see an array when I view source and some settings are affected by JS and some aren't like this. Is there a way we can do this? I also check the filters but not sure how we can set it via filters depending upon what particular field is input.   Any guidance would be awesome.   Thanks,
Chandra
maharzan Staff replied 6 years ago

I see these on the source, if overwriting it doesn’t work, I am wondering what is it used for…

var ea_settings = {“mail.pending”:”pending”,”mail.canceled”:”canceled”,”mail.confirmed”:”confirmed”,”mail.admin”:””….

It would be great to overwrite this or have add_filter overwrite it with some logic. I am using different conditions in the form and sending a slightly different email depending on that form input.

Thanks,
Chandra

Nikola Loncar Staff replied 6 years ago

Hi Chandra, there is already filter for mail content.

Best regards,
Nikola

maharzan Staff replied 6 years ago

I saw that Nikola, I wanted to grab a field setting from ea_fields table and depending on that, I want to change the content of email. I am not sure how to do that.. something like doing get_post(id) for ea_fields. How are you doing that in the plugin?