This topic is locked
[SOLVED]

 Dropdown Field

9/18/2012 5:56:37 PM
ASPRunnerPro General questions
H
hsan author

I have table fields "qty" and "qtyof". How can I configure field "qty" on add page to be a dropdown box and to auto populate according to numerical value of "qtyof" field - ie if "qtyof" value is "5", "qty" dropdown choices are numbers 1,2,3,4 and 5.
Thanks,

Nash

Sergey Kornilov admin 9/18/2012

Nash,
try something like this in Javascript OnLoad event of the page where you need to add this functionality (Add/Edit). This code assumes that qty already is setup as a dropdown box.



ctrl = Runner.getControl(pageid, 'qtyof');
ctrl.on('change', function(e){
num = Number(this.getValue());

$('#value_qty_1').empty();

$('#value_qty_1').append( $('<option></option>').val('Please select').html('Please select') );

for (i=1;i<=num;i++){

$('#value_qty_1').append( $('<option></option>').val(i).html(i) )

}
})
H
hsan author 9/18/2012

Sergey, thanks a lot!!! Works perfect.