We got it working :) The code bellow may help someone else with a similar
problem... Not sure if it's the most elegant way, but it works...
In a controller, we created a function:
def fn_sku():
row=db(db.sku.id == request.vars['po_sku_id']).select().first()
sku_cpu = row.cpu
return sku_cpu
and here is the view:
{{extend 'layout.html'}}
{{=grid}}
<script>
function get_sku_cpu(sku_id) {
$.ajax({
type: "POST",
// url: "http://127.0.0.1:8000/Wholesale/main/fn_sku",
url: "{{=URL('main','fn_sku')}}",
data: ("po_sku_id=" + sku_id),
error: function(XMLHttpRequest, textStatus, errorThrown){
alert(textStatus);
alert(XMLHttpRequest);
},
success: function(result){
$("#po_sku_cpu").val(result);
}
});
}
$(document).ready(function(){
$("#po_sku_sku_id").change(function(event){
// alert("As you can see, the link no longer took you to jquery.com");
var sku_id = $("#po_sku_sku_id").val();
get_sku_cpu(sku_id);
event.preventDefault();
});
});
</script>