Faq

pre Does Floorplans work with form builder plugins, like the WPForms?

Does Floorplans work with form builder plugins, like the WPForms?

Yes, you can add a shortcode in the builder of most form plugins, including WPForms. However, it may be necessary to add some additional code to ensure data handling on the server side.

Some form builder plugins also handle data server side, like WPForms does. When adding a floorplan shortcode to the builder, the selection from that floorplan may be ignored. A solution to this is to add a (hidden) input using the builder and to use JavaScript to fill this input field when the value of the floorplan is changed by a user.

Example

<script type="text/javascript">

	window.addEventListener( "DOMContentLoaded", function(){
		
			//data-id => post_id (34) '-' sequence nr (1)

			var floorplan = document.querySelector( 'div.floorplan[data-id="34-1"]' );
			var input&nbsp;&nbsp;&nbsp;&nbsp; = document.querySelector( '#my-input' );

			floorplan.addEventListener( 'change', function( event ){

					input.value = floorplan.dataset['selection'];
					
				}
			);

		}
	);

</script>
filed under: