Skip to content
TheChatArchiveThe Chat Archive
GLMchatglm3-6b· Zhipu AIHugging Face Arena Human Preference 55K

I am working in Powerapps in the HTML rich text editor. I have blocks of HTML text that…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Metacodellama-34b-instruct’s answer.
  1. User

    I am working in Powerapps in the HTML rich text editor. I have blocks of HTML text that currently appear if certain controls contain data.

    I want to move away from controls and instead use variables context - where when a checkbox is clicked it changes oncheck to UpdateContext({chown_checklist_1:true})

    I want to show this HTML text when this context is true, instead of the invalidity control

    & If(validity_lbl.Text="Invalid",

    m

  2. GLM Assistant

    To achieve this, you can create a custom property in your PowerApps component and use it to store the state of your checkbox. Then, you can conditionally render the HTML text based on the value of this custom property.

    Here's an example of how you can do this:

    1. Create a custom property in your component:
    public class MyComponent : PowerAppComponent
    {
        public bool CheckboxState { get; set; }
    
        protected override void OnAfterRender(bool firstRender)
        {
            if (firstRender)
            {
                // Set the initial value of the custom property
                CheckboxState = false;
            }
    
            // Update the value of the custom property based on the state of the checkbox
            CheckboxState = Checkbox1.Checked;
        }
    }
    
    1. Render the HTML text conditionally based on the value of the custom property:
    <p>{CheckboxState ? "Checked" : "Unchecked"}</p>
    

    Now, when the checkbox is clicked, you can update the value of the custom property using UpdateContext({chown_checklist_1:true}) and the HTML text will be displayed when the context is true.

    If you still want to display the HTML text when the checkbox is unchecked, you can modify the code to conditionally render the m tag as well:

    <p>{CheckboxState ? "Checked" : "Unchecked"}</p>
    
    {CheckboxState ? Checkbox1.Id : Uncheckbox1.Id}
    

    This will display the Uncheckbox1 control if the checkbox is unchecked.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.