Standard Web Form fails to load in v11

Hello ERPNext community, my first topic here.

I find the following issues regarding Web Forms:

  1. In a Date form field, the datepicker widget appears without styling, as shown in this image:

This seems to be because the css file does not load. If I copy the frappe/public/js/lib/datepicker/datepicker.min.css file into the Style Editor in Firefox, it looks fine.

  1. The forms corresponding to the Healthcare module (Lab Test, Prescription and Patient Appointment) don’t have a “Save” or “Cancel” button, as in other forms (like Personal details or Addresses), so I cannot create new data not edit existing ones.

  2. The form fields corresponding to Link FieldType don’t pull the data from the linked DocType. This seems to be the case with v11, but in v10 (specifically v11.1.58) the Link fields pull the corresponding data (I tried with the “Country” Link field in “Addresses” form).

This is my setting:

  • ERPNext version: v11.1.4 (tried with v11.1.3 first)
  • Frappe version: v11.1.4
  • Bench version: v4.1.0 (with frappe_docker)
  • Firefox 60.5.0esr

Testing scenario:

  • Active User with Patient role
  • Standard and default web forms
  • Default Portal Setting

Do you have any idea of how to solve these issues?

Kind regards

Hello and welcome!

1 - bench build should help
2 - These documents are created by system users and portal users are only allowed to view. However, turning on “Allow Edit” in webform configuration should enable these buttons.
3 - “Allow Read On All Link Options” should be turned on for link fields to allow read rights to portal Users

hope this helps, thanks!

2 Likes

Hello @akurungadam,

Thanks for your answer.

  1. The bench build command ran correctly but still having the same issue. (This builds all the js/css files, but I didn’t find the “datepicker.min.css” file in this list.) I ran bench start afterward and it seems to rebuild all the files again (is this the right behavior?). Previously, I tried bench update --build with the same result as bench build.

I made a workaround inserting the following code on erpnext/healthcare/web_form/patient_appointments/patient_appointments.js:

$(document).ready(function() {
    $('head').append('<link rel="stylesheet" type="text/css" href="assets/css/datepicker.min.css">');
}); 

(This works but of course it’s not the ideal solution)

  1. That’s precisely why it’s strange. All my web forms have “Allow Edit” On. As I mentioned, the “Cancel” and “Save” buttons appear in “Personal Details” and “Addresses” Web Forms. I attach the screenshots of my settings.
  2. This works!

Portal settings:
Captura%20de%20pantalla%20de%202019-02-06%2015-52-50

Patient Appointment Web Form:

Patient Appointment Web Form, fields:

Any other idea of how to solve the first and second issues?
Cheers

The second issue happens because, in the erpnext/healthcare/web_form/patient_appointments/patient_appointments.py file, the read_only property is forced to be 1. That’s why in the frappe/website/doctype/web_form/templates/web_form.html template the {% if not read_only and has_header %} never meets.

So, the solution is to remove the read_only property setting.

This helped me as I was struggling why the link field doesn’t load for non-system users. Finally figured out that it’s because of this tick: “Allow Read On All Link Options”

1 Like