Home › Forums › Quform WordPress › Custom fields in email
- This topic has 4 replies, 2 voices, and was last updated 5 years, 7 months ago by starflix.
- AuthorPosts
- September 12, 2018 at 7:32 am #26966starflixParticipant
Hello,
I am looking for a solution for my problem:
I wrote little custom field javascript (if you click one option I get 5 input fields). How do I save them into the database and can display them on email.
Here are picture references:
Code:
<div id="sitemap-builder"> </div> <script> document.querySelector('input[value="defaultSitemap"]').addEventListener('click', function() { createDefaultSiteMap(); }); /*------------------------------------------------------------------------------ --------------------BELOW IS SITEMAP BUILDING CODE-------------------- ------------------------------------------------------------------------------*/ function createDefaultSiteMap() { const htmlElementParent = document.querySelector('#sitemap-builder'); htmlElementParent.innerHTML = ''; //Flush down all inner HTML of the element for(let i=0; i<4; i++) { const x = document.createElement('div'); x.id = "div_dynamic_" + i; htmlElementParent.appendChild(x); } const y = document.querySelectorAll('[id^="div_dynamic"]'); y.forEach(function(parentDiv, index) { const inputEl = document.createElement('input'); const buttonPlusEl = document.createElement('button'); let stringVal = ''; if(index === 0) { stringVal = 'Pradinis'; } else if(index === 1) { stringVal = 'Apie mus'; } else if(index === 2) { stringVal = 'Paslaugos'; } else if(index === 3) { stringVal = 'Kontaktai'; } inputEl.placeholder = stringVal; buttonPlusEl.innerHTML = '+'; parentDiv.appendChild(inputEl); parentDiv.appendChild(buttonPlusEl); }); } /*------------------------------------------------------------------------------ -------------------------------ENDS HERE------------------------------------ ------------------------------------------------------------------------------*/ </script>
Attachments:
You must be logged in to view attached files.September 14, 2018 at 6:44 pm #26991AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
September 19, 2018 at 8:46 am #27010starflixParticipantThank you, it solved my problem, but I have one more question related to this.
Since I added hidden field and now everything goes in there, I am not quite sure how do I format it for example into a list? Right now I have string in line, but what if I want to make it into li elements? I attached image what I have right now. I am fully capable to write html code but if I make my string into something like
<li>Element</li>
it does not work, it just prints those tags.Thank you in advance
- This reply was modified 5 years, 7 months ago by starflix.
Attachments:
You must be logged in to view attached files.September 19, 2018 at 1:31 pm #27026AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
September 20, 2018 at 2:46 pm #27032starflixParticipantThank you very much!
- AuthorPosts
- You must be logged in to reply to this topic.