Announcement

Collapse
No announcement yet.

Sending HTML Hidden Field by POST within Form App

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

  • Sending HTML Hidden Field by POST within Form App

    I have placed the following code within onLoad event of a Form App:

    echo "<input type=\"hidden\" id=\"chosen\" value=\"\">";

    In onValidate, I'm trying to access this field with $x = $_POST["chosen"]; but it keeps saying "undefined index: chosen"

    I do not want to post to a different (blank) form, neither do I want to create the entire Form App as a blank form. I want the hidden data to go along with all regular fields on the form by POST to the onValidate event.

    Is this possible some other way?

  • #2
    I suggest to use [variable_name] .

    If you need variable then use variables in brackets [variable_name]. Like:

    [my_text] = "Text of mine...";

    You can define this [variable] in "Application" => "Global Variable" section in the left sided menu.

    Comment


    • #3
      Originally posted by mitja View Post
      I suggest to use [variable_name] .

      If you need variable then use variables in brackets [variable_name]. Like:

      [my_text] = "Text of mine...";

      You can define this [variable] in "Application" => "Global Variable" section in the left sided menu.
      No: that's for server-side variables of PHP. Here I'm trying to bring a client-side javascript variable into a PHP variable as part of the submitted form of the form App.

      Comment


      • #4
        Hello there

        In your code I don't see the "name" tag.
        If you want to post something inside a <form> you must name it.

        In your case would be this:
        Code:
        echo "<input type=\"hidden\" id=\"chosen\" name=\"chosen\" value=\"\">";

        You can read more about forms here:
        http://www.w3schools.com/php/php_forms.asp
        Regards,
        Cavadinha

        Development Team
        Netmake - IT Solutions

        Comment


        • #5
          Originally posted by Cavadinha View Post
          In your code I don't see the "name" tag.
          If you want to post something inside a <form> you must name it.

          In your case would be this:
          Code:
          echo "<input type=\"hidden\" id=\"chosen\" name=\"chosen\" value=\"\">";

          You can read more about forms here:
          http://www.w3schools.com/php/php_forms.asp
          I've put this and it makes no difference: still says undefined index. The question is if HTML elements created manually this way by an echo statement is carried along in the POST operation of the form by SC.

          Comment


          • #6
            Why not a field hidden? Its the same yoiu are trying to do.
            /Giuseppe

            Professional Scriptcase Services
            Some Customers opinions

            Comment


            • #7
              If I use a hidden text field as you suggest, called say "tempo", how can I get a handle on this in javascript? I know about sc_getfield but it does not work for my use case. I've got an external GUI widget whose creation/ configuration html and javascript code is being sent in on AppInit event of the form. In this code, I need to change the contents of "tempo" within the onChange event (of course since it's not an SC widget, I cannot use ajax events of SC).

              Yup: I know use of external libraries might not be supported/ recommended by Netmake but I'm taking my chances.

              Comment


              • #8
                Originally posted by scriptcaser View Post
                If I use a hidden text field as you suggest, called say "tempo", how can I get a handle on this in javascript? I know about sc_getfield but it does not work for my use case.
                Unhide it, use web tools to know the ID and hide it again.

                I've got an external GUI widget whose creation/ configuration html and javascript code is being sent in on AppInit event of the form. In this code, I need to change the contents of "tempo" within the onChange event (of course since it's not an SC widget, I cannot use ajax events of SC).

                Yup: I know use of external libraries might not be supported/ recommended by Netmake but I'm taking my chances.
                I suppose it depends on widget itself. In third screenshot, you can see a code editor, this is embebbed on a "standard SC" field/widget

                http://giudev.blogspot.com.es/2015/0...v100-beta.html
                /Giuseppe

                Professional Scriptcase Services
                Some Customers opinions

                Comment


                • #9
                  Originally posted by Giu View Post
                  Unhide it, use web tools to know the ID and hide it again.



                  I suppose it depends on widget itself. In third screenshot, you can see a code editor, this is embebbed on a "standard SC" field/widget

                  http://giudev.blogspot.com.es/2015/0...v100-beta.html
                  This is the exact sort of thing I'm trying to do. So by standard SC field/ widget do you mean a text field to which you assign the markup that displays your widget? That's what I have anyway.

                  How are you then accessing the contents of the field (i.e. code lines 1 to 20 etc) in your validate event? That's exact thing I'm trying to pass via my hidden field since the value of the standard SC field becomes the whole html/ javascript/ css of your widget and thus unusable at the backend.

                  Comment

                  Working...
                  X