Forums

Dynamic DropDown worries Part.2

rodiusd 18 Oct, 2013
Hi,

to start we have three dropdown boxes. When the first has a selection then the second got filled. In the event i'm using the vales found in $form-data['vb1'] Now when we select something in the second box the event to fill the third box get fired.

Options should be loaded depending on the values selected in the previous two boxes. However it seems that i can't access the $form-data['vb1'] value. Only the $form->data['vb2'] is available.

So i need to have access to all form values in the php code launched from the event. Tryed already to put a data to session before the custom code, but i don't seems to have access.

The only $form-data field that seems to be available in the ajax event is the sourceid value. No others fields are available.

How can i solve this? Any ideas?
GreyHead 20 Oct, 2013
Hi rodiusd,

You need to include both values in the data that is sent back to the Ajax event. You can add them to the URL or the 'data' part of the PHP. I think that you probably need to hand-code the second Ajax call to get this to work OK.

Here's an example from a client form
    hose_req = new Request.JSON({
      url: 'index.php?option=com_chronoforms&chronoform=hose_configurator_a&event=ajax_a&r=hose',
      method: 'get',
      onRequest: function() {
        // . . .
      },
      onSuccess: function(resp) {
        // . . .
      },
      onFailure: function() {
        // . . .
      }
    }).post({'gas': gas.value, 'size': size.value});

There are a couple of fixed values in the URL and a couple more variable values in the JSON array at the end.

Bob
rodiusd 21 Oct, 2013
Hi Bob,

was already thinking about this path but i don't any clue to how to implement it.

I'm a starter on js and don't think i can pull this off. see that you could help out as payed support;

How could we proceed?
This topic is locked and no more replies can be posted.