fix(webform): allow link fields in web form (#5950)
* fix(webform): allow link fields in web form * fix(webform): don't allow advanced search in links'
This commit is contained in:
parent
ef6f160961
commit
bd5c27a30f
4 changed files with 15 additions and 27 deletions
|
|
@ -136,7 +136,7 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({
|
|||
if (!me.$input.cache[doctype]) {
|
||||
me.$input.cache[doctype] = {};
|
||||
}
|
||||
|
||||
|
||||
var term = e.target.value;
|
||||
|
||||
if (me.$input.cache[doctype][term]!=null) {
|
||||
|
|
@ -176,14 +176,18 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({
|
|||
});
|
||||
}
|
||||
// advanced search
|
||||
r.results.push({
|
||||
label: "<span class='text-primary link-option'>"
|
||||
+ "<i class='fa fa-search' style='margin-right: 5px;'></i> "
|
||||
+ __("Advanced Search")
|
||||
+ "</span>",
|
||||
value: "advanced_search__link_option",
|
||||
action: me.open_advanced_search
|
||||
});
|
||||
|
||||
if (locals && locals['DocType']) {
|
||||
// not applicable in web forms
|
||||
r.results.push({
|
||||
label: "<span class='text-primary link-option'>"
|
||||
+ "<i class='fa fa-search' style='margin-right: 5px;'></i> "
|
||||
+ __("Advanced Search")
|
||||
+ "</span>",
|
||||
value: "advanced_search__link_option",
|
||||
action: me.open_advanced_search
|
||||
});
|
||||
}
|
||||
}
|
||||
me.$input.cache[doctype][term] = r.results;
|
||||
me.awesomplete.list = me.$input.cache[doctype][term];
|
||||
|
|
|
|||
|
|
@ -502,18 +502,7 @@ def get_form_data(doctype, docname, web_form_name):
|
|||
else:
|
||||
frappe.throw(_("Not permitted"), frappe.PermissionError)
|
||||
|
||||
webform = frappe.get_doc('Web Form', web_form_name)
|
||||
|
||||
fields = webform.get('web_form_fields') or []
|
||||
links = {}
|
||||
|
||||
for f in fields:
|
||||
if f.fieldtype == "Link":
|
||||
links[f.fieldname] = [d.name for d in frappe.get_all(f.options, fields=["name"])]
|
||||
|
||||
out.web_form = webform
|
||||
out.links = links
|
||||
|
||||
out.web_form = frappe.get_doc('Web Form', web_form_name)
|
||||
return out
|
||||
|
||||
@frappe.whitelist()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import WebForm from './webform';
|
||||
import WebForm from './web_form_class';
|
||||
import make_datatable from './grid_list';
|
||||
|
||||
frappe.ready(function() {
|
||||
|
|
|
|||
|
|
@ -24,11 +24,6 @@ export default class WebForm {
|
|||
const query_params = frappe.utils.get_query_params();
|
||||
|
||||
web_form.web_form_fields.map(df => {
|
||||
if (df.fieldtype === 'Link') {
|
||||
df.fieldtype = 'Select';
|
||||
df.options = links[df.fieldname]
|
||||
}
|
||||
|
||||
if (df.fieldtype === 'Table') {
|
||||
df.get_data = () => {
|
||||
let data = []
|
||||
Loading…
Add table
Reference in a new issue