Gabor
Gabor

Reputation: 1489

Change content of a w2ui html field

I have a w2ui popup form with a field definition is like this:

{ field: 'step', type: 'html',  html: { label: '', column: 'before', span: 0, html: "xx" } },

On runtime I want to change the content of that field. It is not (directly) based on a record, I would say it is an arbitrary html div. For the sake of simplicity let's say let replace the value "xx" with "coucou"

in the onOpen event ot the popup I'v tried the followings:

w2ui.DocForm.set('step', {html: {html: "coucou"}});

It didn't work, so I tried this:

w2ui.DocForm.fields[0].html.html = "coucou"

with and without w2ui.DocForm.refresh(); after that

The content didn't change. Any idea?

Upvotes: 0

Views: 339

Answers (1)

Gabor
Gabor

Reputation: 1489

Finally I've found a solution. Once I've modified the html field like this: w2ui.DocForm.fields[0].html.html = "coucou", instead of calling refresh(), I had to call

w2ui.DocForm.formHTML = w2ui.DocForm.generateHTML();

That was the trick. I do not understand why it working this way, while for all the other record based fields on the other way, but at least it's working now.

Upvotes: 1

Related Questions