Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- python script
- @app.route('/treatment', methods=['GET','POST'])
- @login_required
- def treatment():
- Patient=Patients.query.all()
- return render_template('treatment.html', title='treatment', li='Diagnosis',Patient=Patient)
- <html>
- <body>
- <button class="add_field_button">Add More Fields</button>
- <div>
- <select class="form-control" name="mytext[]">
- <option >Select a Medicine</option>
- {%for all in Patient%}
- <option value="{{all.id}}" >{{all.registration_no}} - {{all.first_name}} {{all.Sur_name}}</option>
- {%endfor%}
- </select>
- </div>
- </body>
- </html
- <script>
- var max_fields = 10; //maximum input boxes allowed
- var wrapper = $(".input_fields_wrap"); //Fields wrapper
- var add_button = $(".add_field_button"); //Add button ID
- var x = 1; //initlal text box count
- $(add_button).click(function(e){ //on add input button click
- e.preventDefault();
- if(x < max_fields){ //max input box allowed
- x++; //text box increment
- $(wrapper).append('<div><select class="form-control" name="mytext[]"> <option >Select a Medicine</option>{%for all in Patient%}<option value="{{all.id }}">{{all.registration_no }} - {{all.first_name }} {{all.Sur_name }}</option>{%endfor%} </select><a href="#" class="remove_field">Remove</a></div>'); //add input box
- }
- });
- $(wrapper).on("click",".remove_field", function(e){ //user click on remove text
- e.preventDefault(); $(this).parent('div').remove(); x--;
- })
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement