[SOLVED] Expanding Text Area in Alert

I’m creating a text area in an alert on the fly using the following code:

      def lnk_notes_click (self, **event_args):
        # This method is called when the link is clicked
        text_prompt = TextArea(text=self.item['notes'], placeholder='User Notes')
        alert(text_prompt, title='Edit notes.', large=True)
        errors = anvil.server.call_s('update_user_attribute', self.item, 'notes', text_prompt.text)
        self.refresh_data_bindings()

It comes in looking great, just like you’d expect. However, if I try to resize it to get a little more editing room, I can do this:

As far as I can tell, this is entirely cosmetic and doesn’t hurt the functionality of the program at all, so it’s not a big deal all things considered.

As far as fixes, I’ve tried using the width variable for the text area to see if I could constrain the width, but the text area is still adjustable side-to-side. The best workaround I’ve found so far is to set the text area’s auto_expand to True so the user won’t feel compelled to adjust the text box for more room.

Yes, this is default behaviour of the browser. Apparently you can disable it by adding this to the top of your theme.css (in Theme->Assets):

textarea {
    resize: none;
}
1 Like

That’s what I was looking for, and with the auto_expand turned on, it works exactly as intended. Thanks for the quick reply!

1 Like