• Resolved happysusan

    (@happysusan)


    I need help developing a webform that takes the cookie data and adds it to the hidden field of a web form I am trying to get it set up before I buy the pro version, I just don’t know enough about website creation of javascript or html or web form making

    I have a plugin that created a web form- I can create a hidden field I got a bunch of code I can add to add it to a web page
    I have no idea what javascript to add or where to add it to pull the affiliate number into the form.
    I need help developing a webform that takes the cookie data and adds it to the hidden field of a web form I am trying to get it set up before I buy the pro version, I just don’t know enough about website creation of javascript or html or web form making

    I have a plugin that created a web form- I can create a hidden field I got a bunch of code I can add to add it to a web page
    I have no idea what javascript to add or where to add it to pull the affiliate number into the form.

    here is the form html

    <script type="text/javascript">
    function validateBFTProUser(frm, requireName) {
    	requireName = requireName || false;
    	
    	if(requireName && frm.bftpro_name.value=="") {
    		alert("Please provide name");
    		frm.bftpro_name.focus();
    		return false;
    	}
    	
    	if(frm.email.value=="" || frm.email.value.indexOf("@")<1 || frm.email.value.indexOf(".")<1) {
    		alert("Please provide a valid email address");
    		frm.email.focus();
    		return false;
    	}
    	
    	// check custom fields
    	var req_cnt = frm.elements["required_fields[]"].length; // there's always at least 1
    	if(req_cnt > 1) {
    		for(i = 0; i<req_cnt; i++) {
    			var fieldName = frm.elements["required_fields[]"][i].value;
    			if(fieldName !='') {
    				var isFilled = false;
    				// ignore radios
    				if(frm.elements[fieldName].type == 'radio') continue;
    				
    				// checkbox
    				if(frm.elements[fieldName].type == 'checkbox' && !frm.elements[fieldName].checked) {
    					alert("This field is required");
    					frm.elements[fieldName].focus();
    					return false;
    				}		
    				
    				// all other fields
    				if(frm.elements[fieldName].value=="") {
    					alert("This field is required");
    					frm.elements[fieldName].focus();
    					return false;
    				}
    			}
    		}
    	}
    		
    	return true;
    }
    </script>
    
    <form method="post" enctype="multipart/form-data" class="bftpro-front-form bftpro-vertical bftpro-inline-label" onsubmit="return validateBFTProUser(this,false);" action="https://www.kidsmagicworld.com.au/" style="">
    	<fieldset>
    	
    		<div class="bftpro-form-group "><label>Name:</label> 			<input type="text" name="bftpro_name" value="">
    		</div>
    <div class="bftpro-form-group "><label>*Email:</label> 			<input type="text" name="email" value="">
    		</div>
    <input type='hidden' name='required_fields[]' value='email'>		    <input type="hidden"  name="field_229" value="">
    				
    		
    				
    
    			
    			
    	
    	<div class="bftpro-form-group ">
    					<input type="submit" value="Subscribe">
    				
    	</div>
    	</fieldset>
    	<input type="hidden" name="bftpro_subscribe" value="1">
    			<input type="hidden" name="list_id" value="41">
    		
    	<input type="hidden" name="required_fields[]" value="">
    	
    		</form>

    The page I need help with: [log in to see the link]

Viewing 15 replies - 16 through 30 (of 43 total)
  • Thread Starter happysusan

    (@happysusan)

    the field comes up empty

    Plugin Author iova.mihai

    (@iovamihai)

    Hey @happysusan,

    Really sorry about the video! It seems that Vimeo redirected me to another video, right after I logged into my account, that was sent by a customer a long time ago. Not sure why this has happened though, but it seems like I watched another video.

    Even so, after accessing again the link you’ve shared, I did watch the correct video.

    And I believe I found the issue. It seems there’s a typo in the code I’ve sent. The end quote from the function_exists check. Really sorry about this.

    Here’s the complete code:

    <input type="hidden"  name="affiliateid" value="<?php echo ( function_exists( 'slicewp_get_referrer_affiliate_id' ) ? slicewp_get_referrer_affiliate_id() : '0' ); ?>">

    Please update the field’s code and try again. I believe that it should work now.

    Please let me know how it goes.

    Thank you and best wishes,

    Mihai

    Thread Starter happysusan

    (@happysusan)

    that did not work

    Thread Starter happysusan

    (@happysusan)

    same result as before the field is not got any content

    Plugin Author iova.mihai

    (@iovamihai)

    Hey @happysusan,

    Hmm… that’s weird… Can you please change the code to this:

    <input type="hidden" name="affiliateid" value="test">

    Or this:

    <input type="hidden" name="affiliateid" value="21">

    I just want to make sure the field is registering data. If the above two work, then it’s something related to the PHP part of the code I’ve sent.

    Please try the above two and let me know if they work or not.

    Thank you and best wishes,

    Mihai

    Thread Starter happysusan

    (@happysusan)

    <input type="hidden" name="affiliateid" value="21">

    that added 21 to the affiliate ID field in the backend

    Thread Starter happysusan

    (@happysusan)

    <input type="hidden" name="affiliateid" value="test">

    that worked as well

    Thread Starter happysusan

    (@happysusan)

    sorry was I supposed to replace
    the orginal code with the above one

    Thread Starter happysusan

    (@happysusan)

    testing again

    Thread Starter happysusan

    (@happysusan)

    testing again sorry

    • This reply was modified 1 year, 7 months ago by happysusan.
    Plugin Author iova.mihai

    (@iovamihai)

    Hmm…

    Can you please try these as well:

    <input type="hidden" name="affiliateid" value="0">
    <input type="hidden" name="affiliateid" value="<?php echo 0; ?>">
    <input type="hidden" name="affiliateid" value="<?php echo slicewp_get_referrer_affiliate_id(); ?>">

    Also, I’m really sorry for the back and forth! Considering this is a tool I’ve never used, it does take some time to get used to how it works.

    Please let me know how the above perform.

    Thank you and best wishes,

    Mihai

    Thread Starter happysusan

    (@happysusan)

    <script type="text/javascript">
    function validateBFTProUser(frm, requireName) {
    	requireName = requireName || false;
    	
    	if(requireName && frm.bftpro_name.value=="") {
    		alert("Please provide name");
    		frm.bftpro_name.focus();
    		return false;
    	}
    	
    	if(frm.email.value=="" || frm.email.value.indexOf("@")<1 || frm.email.value.indexOf(".")<1) {
    		alert("Please provide a valid email address");
    		frm.email.focus();
    		return false;
    	}
    	
    	// check custom fields
    	var req_cnt = frm.elements["required_fields[]"].length; // there's always at least 1
    	if(req_cnt > 1) {
    		for(i = 0; i<req_cnt; i++) {
    			var fieldName = frm.elements["required_fields[]"][i].value;
    			if(fieldName !='') {
    				var isFilled = false;
    				// ignore radios
    				if(frm.elements[fieldName].type == 'radio') continue;
    				
    				// checkbox
    				if(frm.elements[fieldName].type == 'checkbox' && !frm.elements[fieldName].checked) {
    					alert("This field is required");
    					frm.elements[fieldName].focus();
    					return false;
    				}		
    				
    				// all other fields
    				if(frm.elements[fieldName].value=="") {
    					alert("This field is required");
    					frm.elements[fieldName].focus();
    					return false;
    				}
    			}
    		}
    	}
    		
    	return true;
    }
    </script>
    
    <form method="post" enctype="multipart/form-data" class="bftpro-front-form bftpro-vertical bftpro-inline-label" onsubmit="return validateBFTProUser(this,false);" action="https://www.kidsmagicworld.com.au/" style="">
    	<fieldset>
    	
    		<div class="bftpro-form-group "><label>Name:</label> 			<input type="text" name="bftpro_name" value="">
    		</div>
    <div class="bftpro-form-group "><label>*Email:</label> 			<input type="text" name="email" value="">
    		</div>
    <input type='hidden' name='required_fields[]' value='email'><div class="bftpro-form-group "><label>*test:</label> 			<input type="text" name="field_230" value="">
    		</div>
    <input type='hidden' name='required_fields[]' value='field_230'>		    <input type="hidden"  name="field_231" value="">
    				
    		
    				
    
    			
    			
    	
    	<div class="bftpro-form-group ">
    					<input type="submit" value="Subscribe">
    				
    	</div>
    	</fieldset>
    	<input type="hidden" name="bftpro_subscribe" value="1">
    			<input type="hidden" name="list_id" value="41">
    		
    	<input type="hidden" name="required_fields[]" value="">
    	<input type="hidden" name="affiliateid" value="21">
    		</form>

    the above code does not work

    Plugin Author iova.mihai

    (@iovamihai)

    Hey @happysusan,

    So, if you set the value of the affiliateid hidden field to “test” it works, but if you set it to “21” it no longer works?

    Thread Starter happysusan

    (@happysusan)

    no sorry my bad

    earlier in the form theres

    <input type="hidden"  name="field_231" value="">

    I changed that to

    <input type="hidden"  name="field_231" value="21">

    and it worked

    however if I replace

    <input type="hidden"  name="affiliateid" value="<?php echo ( function_exists( 'slicewp_get_referrer_affiliate_id' ) ? slicewp_get_referrer_affiliate_id() : '0' ); ?>">

    with

    <input type="hidden"  name="affiliateid" value="21">

    does not work

    I will test out the others you said


    I might name a form field affilateID but within the form the form calls it field_231 not sure if that has anything to do with the issue

    Plugin Author iova.mihai

    (@iovamihai)

    Hey @happysusan,

    Based on all the tests, I believe this following code should do the job:

    <input type="hidden" name="field_231" value="<?php echo ( function_exists( 'slicewp_get_referrer_affiliate_id' ) ? slicewp_get_referrer_affiliate_id() : '0' ); ?>">

    Please try it out and let me know how it goes.

Viewing 15 replies - 16 through 30 (of 43 total)
  • The topic ‘cookie dat into hidden field’ is closed to new replies.