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

form may not be a good name for a field?

Is that the most constructive answer to my problem?

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.

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.

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

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’

[QUOTE=reto.peter;39379]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’[/QUOTE]

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.


{Myvirtualfield} = '<a href="../myblankapp/?id="+'.{id}.'>Redir</a>';

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

1 Like

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.

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.

No if you hide the field you can’t get the value from ajax, must be shown. :frowning: :frowning: :frowning:

try maybe
https://forum.scriptcase.net/forum/bugs-ab/84521-button-type-javascript-and-button-php-not-work

It won’t work