Problems, need help? Have a tip or advice? Post it here.
13 posts Page 2 of 2
Sorry it's confusing. Here's an image I've made that will hopefully make everything more clear.
Thanks a lot

t2ZOmdJ.png
t2ZOmdJ.png (150.09 KiB) Viewed 1326 times


(link to view image full size : https://i.imgur.com/t2ZOmdJ.png )
Thanks. That makes things perfectly clear (nice graphic, BTW :) ).

OK, for dropdowns I am sure you know that a hyphen '-' can be used as a value that is considered as not-selected e.g. as in the following where selecting 'Please Select' wll not be considered a valid selection because its value is a hyphen -
Code: Select all
opt_values='Please Select=- | Residential=0 | Commercial=1 | Rental=2'

If your dropdown containing user names does not have such a value, please add it to it.
Now, supposing the dropdown is named 'selected_user', we can slightly modify our original code to add a check for the dropdown as follows -
Code: Select all
<cms:if frm_checkbox_checked ne 'Checked' && frm_selected_user ne '-' >
    <cms:set frm_checkbox_checked = 'Checked' />
    <cms:set my_send_mail = '1' />
<cms:else />
    <cms:set my_send_mail = '0' />
</cms:if>

Effectively, an email would be sent only if *both* the conditions are set -
1. The 'Notification sent' checkbox is not checked
AND
2. A valid user is selected in the dropdown.

Hope this helps.
Hi KK.

The dropdown is a relation field, so I cannot add custom options (I don't think?)

What I thought might of worked was :

Code: Select all
<cms:if frm_checkbox_checked ne 'Checked' && frm_conferencier_dropdown >
    <cms:set frm_checkbox_checked = 'Checked' />
    <cms:set my_send_mail = '1' />
<cms:else />
    <cms:set my_send_mail = '0' />
</cms:if>


But it's not working.
When I create a new entry, even with something selected in that relation dropdown menu field, it's not turning the "checkbox_checked" field to "Checked". I feel like we are super close to fixing the issue.

Not sure why, things are not working.

Here's my full code again for that part of the page:

Code: Select all
        <cms:if k_success >

        <!-- Update variable if not checked -->
<cms:if frm_checkbox_checked ne 'Checked' && frm_conferencier_dropdown >
    <cms:set frm_checkbox_checked = 'Checked' />
    <cms:set my_send_mail = '1' />
<cms:else />
    <cms:set my_send_mail = '0' />
</cms:if>
        <!--  -->

            <cms:db_persist_form
                _invalidate_cache='1'
                _token=k_cur_token
                checkbox_checked = frm_checkbox_checked
            />


            <cms:if k_success >

            <!-- Send email if my_send_mail is equal to 1 -->

            <cms:if my_send_mail eq '1'>
                <cms:send_mail from='admin@mysite.com' to="test@test.com" debug="1">
                    Message
                </cms:send_mail>
            </cms:if>
            <!--  -->


If needed I can pay you so you can take a look at this and fix my issue. I'm running out of time sadly.
Thanks a lot!
13 posts Page 2 of 2
cron