Custom fields in email

Home Forums Quform WordPress Custom fields in email

This topic is: resolved
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #26966
    starflix
    Participant

    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.
    #26991
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #27010
    starflix
    Participant

    Thank 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.
    #27026
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #27032
    starflix
    Participant

    Thank you very much!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy