I have the form 'usertests' with three fields: 'Competency name', 'Course','Test' and two buttons: 'Submit' and 'Add test'. I need to assign a custom function('add_test()') to the button 'Add test'. When a user clicks the 'Add test' button two new fields('Course' and 'Test') are added to the form. I do not understand how to assign custom function to the button. Anybody knows?
It's been a while since I've done it myself, but I dont think you need to create the button. If you add at
$this->repeat_elements() to your form defintion, it will create a "Add xx more" button for you.
Hmm, I'm not sure about that. I know that empty repeated elements should be ignored, but I dont know about removing them once they've been added.