dynamic render tag in htmlform

Hi everyone,

i’m trying to create an htmlform with the possibility to add multiple drugs order for a patient like shown in the image below.

i have created an obsgroup where the child obs are displayed in a table. i noticed that i have to use the repeat tag in order to save all the entry at he same time.

the question is how to make the render tag dynamic by clicking on the + button. right now i have to define it manually.

thanks.

Are you using the repeat tag as documented here? https://wiki.openmrs.org/display/docs/HTML+Form+Entry+Module+Reference

Hello Daniel,

Yes i’m using the repeat tag. But the problem is i dont know how to make the repeat dynamic by clicking on the add button. Right now i have to use the render tag to repeat. In this example i have used n=2 to repeat two times.

Thanks

@marafa Maybe something like this example is what you’re looking for? It’s not fully dynamic (there’s a fixed number adds), but it’s probably sufficient.

Thanks @ibacher, i will have a look at it

Hi @ibacher, i have tried the example but it seems like there is something missing. When i preview the form, the add and the remove button work fine but when i try to use the form in the reference application the add button works as a submit button. if i click on the add button it saves the form.

here is the form code: https://pastebin.pl/view/b54ff4d5

Hi all,

I found the solution. The problem is that the jquery live() method as been replace by the on() method from jquery 1.7, so just replace .live by .on

thanks

1 Like