1

I have two different select option:

Html:

<select id="lstProveedor" class="form-control select2 select2-accessible" aria-hidden="true"></select>
<select id="lstcuadrilla" class="form-control select2 select2-accessible" aria-hidden="true"></select>

Function:

function getCuadrilla(sender) {
    sender.addClass("changed");
    $("#lstcuadrilla")
        .getJSONCatalog({
            onSuccess: function(response) {
                console.log(response);
            },
            url: '/Agenda/GetCuadrillas/' + "?ProveedorID=" + ID,
            valueProperty: "ID",
            textProperty: "NombreComercial"
        });
}

$("#lstProveedor")
    .getJSONCatalog({
        url: '/Agenda/GetProveedores',
        valueProperty: "ID",
        textProperty: "NombreComercial",
        onChange: getCuadrilla()
    });

I want to know how to send valueProperty from $("#lstProveedor") to $("#lstcuadrilla") to get into url: '/Agenda/GetCuadrillas/' + "?ProveedorID=" + ID, on change event, how can I do that?

I try to access it sending into onChange event like:

onChange: getCuadrilla(valueProperty)

then call into function

function getCuadrilla(sender,valueProperty)

but it don´t works. Regards

1
  • you could declare valueProperty as a global variable? then your functions could call valueProperty: varProperty Commented May 30, 2017 at 5:52

1 Answer 1

1

First on the lstProveedor list add this onchange function

<select id="lstProveedor" class="form-control select2 select2-accessible" aria-hidden="true" onchange="getCuadrilla(this.value)"></select>

In your getCuadrilla(ID) have a parameter which will receive this selected ID

You can remove the onchange from the jsoncatalog attached to lstProveedor

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.