How can I “pre-fill” the value of a textarea in an HTML form?

  • Profile Image
    Asked on June 24, 2021 at 03:05 AM

    I'm creating a simple back-end app through which the user can create/update/delete database rows (in this case, job listings).

    When it comes time for the user to edit an existing listing, I'm trying to pre-fill most of the HTML form with the data from that existing row. I've done this sucessfully for text inputs using the "value" property, and with selects using a bit of php in each option tag: if([conditionforoption]){echo'selected'}.

    The input type that I'm having trouble pre-filling is the textarea... any thoughts on how to get the existing data (a long varchar string) to be present in the textarea input when the user loads the page?

    Ask Question

  • Profile Image
    Answered on June 24, 2021 at 09:44 AM

    Hi there!

    I hope you're doing well.

    Can you kindly share with us the URL of the form so we can further check? As well, if you can send us some screenshots of what you're exactly trying to do, that'd be greatly appreciated.

    We look forward to hearing from you.