[Bug] Cannot set Text Editor's content with frappe.new_doc()
See original GitHub issueAssume I have a DocType Task
with these fields:
subject
(Data
)description
(Text Editor
)
If I call the following in JavaScript, the new Task
s subject
will be set to “New task” but the description
will be left blank.
frappe.new_doc("Task", {"description": "Do stuff", "subject": "New task"})
Same problem with frappe.route_options()
.
This happens with all fields of type Text Editor
.
Though this works:
frm.doc.description = "Do stuff"
frm.refresh()
Version
Frappe Framework: v11.1.32 (master)
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Configuring the Portable Text Editor - Sanity.io
How to configure the Portable Text Editor.
Read more >The CMS Guide: 6 problems to overcome in your rich text editor
Learn about 6 most common CMS problems you can face while managing and editing web content and how the right rich text editor...
Read more >Git - OpenForge
raise AttributeError() ... `site_config` is a set of site wide settings like database name, password, ... frappe.throw(_("Can not edit Read Only fields")).
Read more >Editing rich text content | Xperience 13 Documentation - Kentico
You can edit the content in a WYSIWYG ("What You See Is What You Get") manner, which is an intuitive way to create...
Read more >Build rich text editors in React using Draft.js and react-draft ...
Rich text editors enable you to control the appearance of the text and provide a powerful way for content creators to create and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sure. I have some end-of-year deadlines for the organization I am setting up with ERPNext, so I likely won’t get to it until early in the new year, but would be happy to.
Some comments on the PR #11900 I just filed to address this: since it turns out not to be practical to simply allow any field to be specified by the route_options argument to frappe.new_doc – in particular, trying to set fields of type Table in this way goes haywire – I left the route_options alone, and instead enhanced the behavior of the init_callback argument, so that it is called regardless of whether the DocType has a Quick Entry form. So with #11900 in place, the OP can accomplish the original desired effect via:
frappe.new_doc("Task", {"subject": "New task"}, doc => {doc.description = "Do stuff";});
and (for example) I can create a new Journal Entry with the posting date set and an accounts line filled in via