Hi,
I was wondering what would be the best approach for the following
situation:
I have a form that has some fixed input fields. In addition there are
fields the use can add or remove dynamically.
Is there a way to do this using form or custom form, or do I need to write
all the code myself.
Currently I wrote the form manually, but this means that I need to write
all the validation and error display as well. Am I right?
Here is a snippet of an example code showing my use-case:
{{extend 'layout.html'}}
value1
value2
Add a Stop
value3
value_middle
Remove
$(document).ready(function(){
$('#add_station_btn').on('click',function(){
$('#middle_stations').append($('#middle_template').html());
var index=$('#middle_stations li:last').index();
var newname=index+'_value_middle';
$('#value_middle').attr('id',newname);
$('#'+newname).attr('name',newname);
var newname=index+'_remove_station_btn';
$('#remove_station_btn').attr('id',newname);
$('#'+newname).on('click', function() {
$(this).closest('li').remove();
});
});
});
Thanks
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.