Bring Data into HTML field in the DocType


I need to show the data from the database table into the HTML field of the Doctype ( custom created with ‘Setup’ Document Type).

Anybody know how to display data in the HTML field,while loading the custom created doctype.?

  1. Create html template
  2. add it to build.json -
  3. add app_include_js in hooks -
  4. Changes in doctype’s py
  5. Changes in doctype’s js -

This shows driver’s photo under Vehicle.


Thank you for the detailed reply…
Let me try

@revant_one Thank you for putting this out here! I am trying to understand what’s going on in the python and JS portions of your app. I am trying to strip it back to something super simple and I’m getting hung up on the way your app brings in the HTML template.
Sorry for resurrecting this thread, but I think this is a really helpful technique if I could get it working.

1 Like

frappe.render_template used in javascript returns rendered html string.

It takes 2 parameters,
template name e.g driver_list
and dictionary e.g. cur_frm.doc.__onload.

template names are defined using the first three steps 1) create a John Resig template HTML, 2) add it to build.json, 3) add it to hooks so it is available for app.

reference :

instead of using tmpl() use frappe.render_template()

example using render_template in desk page

template file defined here

changes in hooks

add template to build.json

Can it be done for the web forms?

If you wish to build a custom functionality into web pages refer how current pages from www directory work.

also check documentation for portal development :