0

I have a webform and my leadid_token is generated from Jornaya. and there is a script code that we just put to my webform. My issue is I want to POST the value of tokens to my portal cms how can we do this EX:

<form method="post" action="https://portalcmssample.php" id="form1">
    <input id=" leadid_token " name="universal_leadid" type="hidden" value= "" /></div>
</form>

I did not see the value of the token appearing to my cms portal after I submit? Is there anything I've done wrong?

halfer
  • 19,824
  • 17
  • 99
  • 186
Network
  • 1
  • 1
  • 1
    Please take a moment (when you can) to learn the 'code' tool in the editor - this is how pasted code is formatted so that HTML is rendered as text rather than HTML. – halfer Oct 19 '16 at 18:47
  • Can you help me on my issues concern please! – Network Dec 06 '16 at 21:40
  • I don't think this question has enough information to answer. The element `value` is empty, but is that replaced using JavaScript? The `id` is invalid too (contains spaces) but I don't know if that would affect things. What other information can you give us about how the post operation works in your app? – halfer Dec 06 '16 at 21:46
  • The form `action` is invalid too - if you are specifying the `https` protocol then you must specify a reachable domain and directory/file on that server, e.g. `https://portal.com/cmssample.php`. – halfer Dec 06 '16 at 21:48

1 Answers1

2

Old question with an easy answer. We use the following solution, which utilizes jQuery. Ensure that you've included jQuery with your scripts and then include this code following after:

<script type="text/javascript">
  $(document).ready(function () {
  if (!$('#leadid_token').length) {
    $('form').last().append(
      $('<input>').attr({
        type: 'hidden',
        id: 'leadid_token',
        name: 'LeadiDToken'
      }));
  }});
</script>
<script id="LeadiDscript" type="text/javascript">
    // Your Jornaya script goes here
</script>

This code will automatically append a hidden field to your form. Jornaya's script will automatically populate the value of this form after it loads async. The value will be submitted to the server when the form is submitted.

Bryan
  • 101
  • 10