We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Editing channel entries using front end forms

How Do I?

amyvarsho's avatar
amyvarsho
3 posts
4 years ago
amyvarsho's avatar amyvarsho

I’m new to channel forms. I’m trying to accomplish having a signed in user create a channel entry into a nonprofit channel, then view that entry and make changes to the existing text on the front-end. My question is, how do I pull the existing entry data and update the entry on the front-end? Does anyone have an example I could look at to get an idea? I have been looking through the docs and google and I can not seem to figure this out.

Here is some of my code that collects the user’s information. It works fine creating a new entry id, and storing the information into the Nonprofits channel .

 {exp:channel:form channel="Nonprofits" return="Nonprofits/edit/ENTRY_ID" entry_id="{segment_3}"}
   <div class="row justifty-content-center">
          <div class="col-lg-8 mt-6 mt-lg-0 pt-2">
            <form class="mt-4">
            <fieldset>
            <legend class="fs-3 fw-600 text-center">Nonprofit Information</legend>
            <div class="form-group">
            <label>Title</label>
             <input type="text" name="title" id="title" value="{title}" size="50" maxlength="100" >
            </div>

           <div class="form-group">
           <label> URL Title</label>
            <input type="text" name="url_title" id="url_title" value="{url_title}" size="50" maxlength="100">
           </div>

             <div class="form-group">
              <label>Organization Summary</label>
              <textarea class="form-control" name="org_summary" value="{org_summary}"type="Expresso" rows="4" cols="50"></textarea>
              </div>

             <div class="form-group">
                <label>Describe Your Organization</label>
                <textarea class="form-control" name="describe_your_organization" value="{describe_your_organization}"type="Expresso">
                </textarea></div>

Then the user has an option to “edit their profile” by clicking this link Edit your profile

Takes the user to the edit_profile_entries template which has the opening tag: {exp:channel:form channel="Nonprofits" return="Nonprofits/edit/ENTRY_ID" } <main> <section class=”background-white” id=”nonprofits_profile”> <div class=”container”>

   <div class="row justifty-content-center">
          <div class="col-lg-8 mt-6 mt-lg-0 pt-2">
            <form class="mt-4">
            <fieldset>
            <legend class="fs-3 fw-600 text-center">Nonprofit Information</legend>

             <div class="form-group">
              <label>Organization Summary</label>
              <textarea class="form-control"  name="org_summary" value="{org_summary}"type="Expresso" rows="4" cols="50"></textarea>
              </div>

             <div class="form-group">
                <label>Describe Your Organization</label>
                <textarea class="form-control" name="describe_your_organization" value="{describe_your_organization}"type="Expresso">
                </textarea></div>

                <div class="form-group">
                <label>Board Member Position</label>
                <input class="form-control" name="board_member_position" value="{board_member_position}" type="Expresso">
                </div>
              <div class="form-group">
              <label>Board Term</label>
              <input class="form-control" type="text"name="board_term" value="{board_term}" placeholder="eg: 1 year">
             <div>

This template only shows the empty fields and not the data the user already has entered. I’m using expression engine v5.4 still. Thanks for any advice

       
pinkimp's avatar
pinkimp
4 posts
4 years ago
pinkimp's avatar pinkimp

You’re on the right track - all you need to do is wrap the form on the “Edit your profile” page in the channel:entries tag.

Something like this should work:

{exp:channel:entries channel="nonprofits" entry_id="{segment_3}” status=”open”}

{your_form}

{/exp:channel:entries}

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.