Using the following model:
db.define_table('akb_authors',
Field('surname'),
Field('firstname'),
Field('name'),
)
self.db.akb_authors.surname.widget = suggest_widget(self.db.
akb_authors.surname,
limitby = (0, 20
), min_length = 2)
self.db.akb_authors.firstname.widget = suggest_widget(self.db.
akb_authors.firstname,
limitby = (0, 20
), min_length = 2)
Using SQLFORM.factory which includes other fields not shown here I want to
the 'name' field to have a default value formed by the first two fields
like this: 'surname' + ' , ' + 'firstname'
I have tried with the following code and it is doing nothing for what I can
see and I am too much of a beginner with jquery/javascript to know how to
debug it using Firebug:
<script>
$(document).ready(function() {
$('form:input[name = "surname"]').change(function() {
var van = $('#no_table_surname').val();
var fn = $('#no_table_firstname').val();
$('#no_table_name').val(van + ' , ' + fn);
});
$('form:input[name = "firstname"]').change(function() {
var van = $('#no_table_surname').val();
var fn = $('#no_table_firstname').val();
$('#no_table_name').val(van + ' , ' + fn);
});
</script>
What am I doing wrong?
Regards
Johann
--