This is a migrated thread and some comments may be shown as answers.

Pass in parameter AND get selected values

1 Answer 641 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Bradley
Top achievements
Rank 1
Bradley asked on 21 May 2014, 03:21 PM
Greetings,

I'm looking for a way to pass in Model data in an on change event on the combo box but also easily retrieve the selected value.

Note, this changes the onChange event delcaration from something like:
.Events(e =>
{
e.Change("ddlOnChange");
})

To:
.Events(e =>
{
e.Change("ddlOnChange('" + Model.Values + "')");
})

Which means
function ddlOnChange(e) {
alert(e); // <-- is no longer valid, because the event is now the passed in object
alert("value: " + this.value()); // Also no longer works, because 'this' becomes the page as a whole
};

Any easy way to do this other than Jquery to the id of the control and snag the value?

Any help would be greatly appreciated.

1 Answer, 1 is accepted

Sort by
0
Bradley
Top achievements
Rank 1
answered on 21 May 2014, 08:31 PM
So I solved this by not modifying the function call to pass in anything and just accessed them directly within the function itself.
Tags
ComboBox
Asked by
Bradley
Top achievements
Rank 1
Answers by
Bradley
Top achievements
Rank 1
Share this question
or