Support

Account

Home Forums Front-end Issues Get Default field value from URL

Solved

Get Default field value from URL

  • Hello, i need a help for my frontend form.

    01. How can i get Field Value from my url link ?
    Ex. http://www.domain.com/?id=“xxx” > Get Value from a field_name ( not the post title ) base on this ID, and set as default value on field_name into new submission.

    02. I need to set multi submit button, but for different “return” redirect link.

    Thank you.

  • SOLVED

    i use javascript to set value

    <script type="text/javascript"> 	
    $(document).ready(function(){
    	$.urlParam = function(name){
    		var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
    		return results[1] || 0;
    	}
    	$("input[name='acf[%FIELD NAME%]']").val($.urlParam('parent'))
    });
    </script>

    Change “FIELD NAME” with field name like [field_5e8d66375739f]

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.