Project

General

Profile

bindWidget plain text not working

Added by Mahmudul hasan about 6 years ago

I want assign some text only in the variable - ${val\"}

My html control :

<input type="text" class="form-control" id="input07" value="${val}" disabled="disabled"/>

Source code :

Wt::WText* m_myText= nullptr;

m_myText= mlvTemplate->bindWidget("txtIpOct1", Wt::cpp14::make_uniqueWt::WText());

m_myText->setText(data.c_str());

In output i can see there is a span placed in the value as a result the design is breaking down.

Can't we just set the expected value in plain text?


Replies (4)

RE: bindWidget plain text not working - Added by Mahmudul hasan about 6 years ago

bindString reloads the full template. I do not want it.

RE: bindWidget plain text not working - Added by Apivan Tuntakurn about 6 years ago

I'm not sure I understand what you meant by assign a text.

How about using WLineEdit? This widget generate the input element. Do you want a static ID?

RE: bindWidget plain text not working - Added by Wim Dumon about 6 years ago

Hey,

Event bindString is not ideal for binding parameter values: escaping will not be done correctly, and the XSS filter will not catch problematic situations. The targets for bindString() are intended to be placed inside XML elements.

In this case, instantiating a WLineEdit seems the logical path to follow.

Best regards,

Wim.

    (1-4/4)