and then I have selected the email-target field in the notification option "Send notification to an email specified in an email field included in the form:".
The email is not sent.
Then I read Waquar here : https://toolset.com/forums/topic/send-cred-form-notification-using-generic-fields/
writing: The option "Send notification to an email specified in an email field included in the form:" doesn't work with the generic fields.". But if this is true why I can select the email-target generic field in the email notification wizard ?
I am lost: is there anything wrong in my code or the email isn't sent for other reasons ?
Ordinarily you cannot choose to send an email notification to an email address that comes from a generic email field in the form, it is not available for selection.
You have been able to do it, though, because you are using the advanced editor and have added "persist":1 to the JSON settings for the field (meaning that the value of the custom field will be saved along with the post submitted by the form).
If it isn't working, isn't sending a notification, I suspect it is because where you are trying to provide a default value coming from a types shortcode, you have not wrapped that in double quotes (just as you would if you hard-coded an email address there).
I suggest you temporarily remove the class="hidden" from the field wrapper so that when submitting the form you can see if the generic email field actually contains a useable email address.
Hello Nigel,
you are right, I added the double quotes and made the field visible, what I've found is that the field on the form is empty, there is just a <div></div>, nothing else .... any clue ?
thanks
Regards
Nicola
Where do you display the post form?
If it is single post, you can use item="current_page" attribute to output current post information, for example:
[types field='band-email' output='raw' item="$current_page"][/types]
Hi
I added item="$current_page" but nothing changed. Yes, the form pops up in a Kadence modal on a single post page (band). I have another form in another modal that works perfectly, the only difference is that it sends the notification to the post author instead of an email field.
Here is the code that works (author):
directly on the form and it shows the correct address, while the same is not passed to the generic field (I added a red border, you can see it's empty)
thanks