Display DocType in Webview

How do I display form for a doctype in a web view without using desk webforms. For instance, a new member will have to fill in his details and select a package to finish registering. An existing member will only select package he wants and checkout. I have created doctype for member and packages. How do I display both member form and package selection in web view.

Why not using webform?
It is easy to use webform as it is based on the doctype.
Webform is like Customize Form but for web side (outside of desk).

To answer your question:

  • You can build html file and put it in the www directory of a custom app.
  • Use jinja for the placeholder for fields.
  • Put code in the py and js files of the same name in the doctype directory.

thanks for your response. I tried webform but it didn’t give me desired results. I wanted a form where member fills in his details and then selects their subscription package. I have a doctype for member, packages and then subscription, which holds a link to member and his package. displaying subscription in webform only displays field to select member and package. Is there a better way to go about that …?

With your second suggestion, does using Jinja for placeholder mean I have to write html for form with various input fields …?


So you have the Member doctype as link field in the Subscription.
If so then yes the Member is a select field.

You can fill the data if Member is a child table to the Subscription doctype.


oohk … thanks for the headsup… will make member table child table of subscription.

in that case how do I capture form data and save to database … ?

thanks very much for your response.

The same as you would before.

in using a webform, frappe renders the form with a save or submit button which, means frappe handles the form submission and saving. if I design form myself, I don’t I need to define submit url and capture form fields from request to save into db … ?

If you create the webform using the doctype as template, yes the button will handle the submission and saving. You can also put code in webform or doctype py to affect the logic and process of the webform before, during, or after the submission.
You can also insert a document in other doctype using this method.

But if you make the webform yourself by creating a html file and put it in the www directory of your custom app, then you need to make the code to handle the process yourself.
And I’m not the expert in coding so sorry I can’t help you on this. :wink:

:pensive::pensive::pensive:. Thanks all the same. you have really been of great help. I will play with the code and see. Thanks a lot.