Announcement

Collapse
No announcement yet.

Assign a hidden var to a User Definable var

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Assign a hidden var to a User Definable var

    Hiya

    Within the code in a page (Act_Order02 for example), is it possible for me to assign the value I have in a hidden variable to one of the User Definable variables eg.

    NETQUOTEVAR:GENERALPROMPT000 = my_hidden_variable

    If it is possible, how would I go about doing this (what code would I use)?

    Many thanks,

    hp.
    mobilize-me ltd
    www.mobilize-me.com

    #2
    If your data is in a hidden <input type=hidden id="myhiddendata"> field then try replacing

    Code:
    <input type="TEXT" name="GENERALHOWFOUND" size="40" maxlength="255" value="NETQUOTEVAR:GENERALHOWFOUND">
    with
    Code:
    <input id="general000" type="TEXT" name="GENERALHOWFOUND" size="40" maxlength="255" value="NETQUOTEVAR:GENERALHOWFOUND">
    and add a little JavaScript (after both these fields are defined)
    Code:
    <script language=JavaScript>
    <!--
    document.getElementById('general000').value = document.getElementById('myhiddendata').value;
    //-->
    </script>
    Norman
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Thanks for that Norman

      Earlier I posted this thread.

      http://community.actinic.com/showthread.php?t=10462

      Do you think this way would work better or be easier than using the 'Reffer Script' method ?

      Thanks

      hp.
      mobilize-me ltd
      www.mobilize-me.com

      Comment


        #4
        I've no idea. I didn't mention the other method and as it's not a worked example, only a suggestion it would be up to you to implement it.

        However if you have something stored in a cookie, then you could easily get its value and set it into the required field using JavaScript. There are cookie handling routines already available in actiniccore.js or actinicextras.js.

        Norman
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          Thanks again Norman.

          In place of using a Hidden Variable, would it be possible to assign a Session Variable I have created to the "GENERALHOWFOUND" variable? Would the code to do this be the same as you posted above ?

          ie/ if I have a session variable called MySessionVariable I would assign it as follows:

          <script language=JavaScript>
          <!--
          document.getElementById('general000').value = document.getElementById('MySessionVariable').value;
          //-->
          </script>


          Thanks

          hp.
          mobilize-me ltd
          www.mobilize-me.com

          Comment


            #6
            "Session variable"? That's not part of JavaScript. What language are you talking about?

            If you are talking about PHP then use PHP to create the JavaScript that sets the Actinic field. Something like:-

            Code:
            <script language=JavaScript>
            <!--
            <?php
            $mytemp = $_SESSION['myvariable'];
            print "document.getElementById('general000').value = 'mytemp';";
            ?>
            //-->
            </script>
            You could use PHP to create the <input...> field directly but this may get in the way of Actinics NETQUOTEVAR expansion.

            Norman

            PS this may have bugs. I just made it up and typed it straight in.
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              Thanks Norman

              I think i may go the hidden variable route. Will try figure it out in the morning.

              hp.

              PS: I have also posted a thread asking how this could be done using .php session vars and/or cookies. thought it may be helpful to other to have them in a seperate thread???
              mobilize-me ltd
              www.mobilize-me.com

              Comment

              Working...
              X