Announcement

Collapse
No announcement yet.

Problem with Ajax onClick-Event, Parameters will not be passed

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

  • Problem with Ajax onClick-Event, Parameters will not be passed

    I have created a grid-application on a table with multiple fields (guess there are only two fields, “Name” and “Form”).
    Only the “Name” field will be shown on the grid.

    I have then created an Ajax onClick-Event on the “Name”-field and i marked the “Form”-field to be passed as parameter.

    Now i can't access this fields in the code, (I’ve tried: Form, {Form}, [Form], $Form), but nothing seems to work.

    The “Parameters”-page of the Ajax-event is empty, no fields are shown here (as described in the manual).

    I use Scriptcase-Version: 7.01.0010

  • #2
    form may not be a good name for a field?
    Dave Mason
    http://www.applicationallstars.com/i...emberbadge.gif
    www.applicationallstars.com
    car_man46@yahoo.com

    Comment


    • #3
      Originally posted by davem View Post
      form may not be a good name for a field?
      Is that the most constructive answer to my problem?

      Comment


      • #4
        Marcus,

        The parameters show up in my version of scriptcase (same version as you have), but they are way down on the bottom. I will need to look at the code to see what is actually passed. You could view the generated code (I try to put a unique string when I test to make it easier to search on). I will try to look into this on Monday.

        Comment


        • #5
          Beside this problem, the workaround might by by not passing parameters but just access the formvariable between {} Does this not work? I use this method on checkboxes to enable and disable blocks w.o. problems.
          Albert Drent
          aducom software netherlands
          scriptcase partner, reseller, support and (turn-key) development
          www.scriptcase.eu / www.scriptcase.nl

          Comment


          • #6
            If you double click the Parameter to 'active' (at the bottom of the Ajax-Event-Screen), then you can use it in your code as a Global Variable

            Comment


            • #7
              I just made a full test with ajax events and parameters within GRID rows
              What I wanted to achive is to have a button on each row, which is doing something with the data for only this row. So I need the id of the row (database-field)
              I did not want that the ID-field of the row, lets say "wood_item.id" is shown on the GRID, cause that is useless for the client.

              The generated ID-field from ScriptCase had the name: wood_item.id (see in Edit fields, or Fields positioning)
              Inside the Ajax-Event, I can now access this field, but:
              [wood_item.id] --> does NOT work
              but
              [wood_item_id] --> WORKS

              well, at least I found a solution, but the strange things are, that the parameter settings are irrelevant and that ScriptCase is changeing the fieldname from wood_item.id --> wood_item_id

              And: if I am using this [wood_item_id] in more than 1 Application, it becomes a problem. The Global Variable becomes 'Undefined'
              Last edited by reto.peter; 08-02-2015, 03:18 AM.

              Comment


              • #8
                Originally posted by reto.peter View Post
                I just made a full test with ajax events and parameters within GRID rows
                What I wanted to achive is to have a button on each row, which is doing something with the data for only this row. So I need the id of the row (database-field)
                I did not want that the ID-field of the row, lets say "wood_item.id" is shown on the GRID, cause that is useless for the client.

                The generated ID-field from ScriptCase had the name: wood_item.id (see in Edit fields, or Fields positioning)
                Inside the Ajax-Event, I can now access this field, but:
                [wood_item.id] --> does NOT work
                but
                [wood_item_id] --> WORKS

                well, at least I found a solution, but the strange things are, that the parameter settings are irrelevant and that ScriptCase is changeing the fieldname from wood_item.id --> wood_item_id

                And: if I am using this [wood_item_id] in more than 1 Application, it becomes a problem. The Global Variable becomes 'Undefined'
                If i understood correctly, you can manage a link from onrecord and use {id}

                Example, create a virtual field on your grid, and on record event.
                Code:
                {Myvirtualfield} = '<a href="../myblankapp/?id="+'.{id}.'>Redir</a>';
                Last edited by Giu; 08-02-2015, 03:34 AM.
                /Giuseppe

                Professional Scriptcase Services
                Some Customers opinions

                Comment


                • #9
                  I am talking about the Code inside the Ajax-Event.
                  Sometimes the Ajax-Event is even not called

                  Comment


                  • #10
                    Hi, I had the same problem, what I discovered is that when you set up a field to be used passes as a parameter in a Ajax event (double clicking its name in the Ajax-event window) it works fine until you set up a link using the same field, it loses it's ajax-event functionallity, I don't know if it is a Scriptcase bug.

                    Comment


                    • #11
                      I know this is an old thread but the most elegant solution to the initial issue is to add the field needed in the ajax event to the list of used fields and then indicate it as hidden so it doesn't show-up in the form at all but can still be accessed using {}. Hope this helps someone.

                      Comment

                      Working...
                      X