HTML String

The HTML String component is used to allow the user to input raw markup. If the field is not modifiable then the markup will be rendered as is without the editor.

HTML String user control

Component Code

The first section of the code for the component contains the standard parameter set along with the variables needed for the component to function. Following the variables are the methods used by the component which are listed below.

OnParametersSetAsync()

This method is called when the component initializes and when there’s an update to the parent component. Its purpose is assign values to variables.

ValueChanged()

This method is called when the value inside the HTML component has changed. This method accepts one string argument which will contain the value of the HTML Editor. This method, before anything makes sure that the field is modifiable. If the field is modifiable then a check is made to ensure there are no validation errors, if valid then the ChangeXML method is called, otherwise nothing happens.

ChangeXML()

This method is used to update the XML of the instance to reflect the value inside of the HTML String field. When called the required XML is generated, the element name is equal to the XMLName variable, and the value is the ValueUX variable equal to the new information entered in the component attempting to be saved.

Lastly, a call is made to the ChangeField method on MyInstance and the new XML is passed.

Below is an example of the XML structure that’s saved:

<HTMLStringTest>&lt;h3&gt;Some HTML in an H3 tag!&lt;/h3&gt;</HTMLStringTest>
Updated on May 4, 2023

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support

Leave a Comment