From c9d1dc35900aab455597bce86eeba7e578550f22 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Sat, 24 Sep 2016 17:33:23 +0530 Subject: [PATCH] [web forms] handle mandatory optional and other fixes --- frappe/templates/generators/web_form.html | 104 ++++++++++++------ frappe/website/doctype/web_form/web_form.json | 29 ++++- 2 files changed, 101 insertions(+), 32 deletions(-) diff --git a/frappe/templates/generators/web_form.html b/frappe/templates/generators/web_form.html index ae97f243a2..c719e798be 100644 --- a/frappe/templates/generators/web_form.html +++ b/frappe/templates/generators/web_form.html @@ -57,7 +57,7 @@ {% if field.placeholder -%} placeholder="{{ _(field.placeholder) }}" {%- endif %} data-label="{{ _(field.label) }}" data-fieldtype="{{ field.fieldtype }}" data-doctype="{{ field.parent }}" data-default="{{ field.default or "" }}" - {{ (field.reqd and field.fieldtype!="Attach") and "required" or "" }} + {{ (field.reqd and field.fieldtype!="Attach") and "data-reqd=1" or "" }} {{ field.read_only and "disabled" or "" }} {% endmacro -%} @@ -90,14 +90,14 @@ {{ field.options }} {% elif field.fieldtype in ("Data", "Date", "Datetime") %} -
+
{% if with_label %}{{ label(field) }}{% endif %} {{ help(field) }}
{% elif field.fieldtype=="Link" %} -
+
{% if with_label %}{{ label(field) }}{% endif %} {% for option in field.options.split("\n") -%} @@ -121,7 +121,7 @@ {{ help(field) }}
{% elif field.fieldtype=="Text" %} -
+
{% if with_label %}{{ label(field) }}{% endif %} {{ help(field) }}