<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="283640" data-post-id="283640">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Sidi_Mohammed" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Sidi_Mohammed
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thank you <a class="mention" href="/u/jmnda" rel="nofollow">@jmnda</a> for those links</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="283640" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/submitting-multi-inputs-types-in-phoenix-liveview/54942/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-283640" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="283640"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="283653" data-post-id="283653">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="GazeIntoTheAbyss" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  GazeIntoTheAbyss
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Is this what you’re looking for?<br>
</p><div class="lightbox-wrapper"><a class="lightbox" href="https://forum.elixirforum.com/uploads/default/original/3X/3/a/3a97bf28e0ba4d91e49e4e9ab237f3f81531a0f3.png" data-download-href="https://forum.elixirforum.com/uploads/default/3a97bf28e0ba4d91e49e4e9ab237f3f81531a0f3" title="Multiselect" rel="nofollow"><img src="https://forum.elixirforum.com/uploads/default/original/3X/3/a/3a97bf28e0ba4d91e49e4e9ab237f3f81531a0f3.png" alt="Multiselect" data-base62-sha1="8mkOai3WBDVHrJWdeaWGcUhJfgL" width="103" height="131"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">Multiselect</span><span class="informations">103×131 2.49 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><p></p>
<p>The options bit are a bit confusing to add if you don’t know how already. I asked someone the other day how to do it and ended up with this.<br>
Add <span class="mention">@options</span> with your options in the formcomponent.ex and add :options to the socket.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">  @options [
    {"Newest", "newest"}, 
    {"Oldest", "oldest"},
    {"Popular", "popular"},
    {"Least Viewed", "least viewed"},
    {"Most Popular", "most popular"}
  ]

  @impl true
  def update(%{example: example} = assigns, socket) do
    changeset = Example.change_example(example)
    {:ok,
    socket
    |&gt; assign(assigns)
    |&gt; assign(:changeset, changeset)
    |&gt; assign(:options, @options)
    }
  end
</code></pre>
<p>Your inpute type then just needs to be set to “select” and options are obviously the :options in the socket.</p>
<p>:example is whatever your database field is named</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">&lt;.input field={f[:example]} type="select" options={@options} /&gt;
</code></pre>
<p>Hope this is what you were after.<br>
edit: No idea why I added so many random popular options lol</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="283653" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/submitting-multi-inputs-types-in-phoenix-liveview/54942/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-283653" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="283653"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="283681" data-post-id="283681">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Sidi_Mohammed" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Sidi_Mohammed
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thank you <a class="mention" href="/u/gazeintotheabyss" rel="nofollow">@GazeIntoTheAbyss</a>, this is so helpful, I understand the idea, that means <code>:example</code> field will be associated with multiple values in <code>handle_event/3</code> which are selected by the user</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="283681" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/submitting-multi-inputs-types-in-phoenix-liveview/54942/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-283681" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="283681"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="283685" data-post-id="283685">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Sidi_Mohammed" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Sidi_Mohammed
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>This is what <a class="mention" href="/u/jmnda" rel="nofollow">@jmnda</a> mentionned above, with <code>multiple</code> attribute you can select multi values</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="283685" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/submitting-multi-inputs-types-in-phoenix-liveview/54942/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-283685" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="283685"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="283813" data-post-id="283813">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Sidi_Mohammed" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Sidi_Mohammed
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Just last thing, as <a class="mention" href="/u/codeanpeace" rel="nofollow">@codeanpeace</a> has suggested, <code>IO.inspect/1</code> is required to see what was happening behind scenes because we can’t make any expectation about, for example the Component Function implementation for both <code>&lt;.input field = {@form[:username]} type = "text"&gt;</code> and <code>&lt;.input field = {@form[:username]} type = "radio"&gt;</code> is <a href="https://github.com/phoenixframework/phoenix/blob/f8c0ad26ee031ee87a6e7307f6dc1f7722134dd5/installer/templates/phx_web/components/core_components.ex#L337" rel="noopener nofollow ugc">here</a> but for <code>text</code> we will find user’s entry in <code>handle_event("submit", %{"user" =&gt; %{"username" =&gt; username....)</code> but for <code>radio</code> we will find it in <code>handle_event("submit", %{"user" =&gt; params, "name_of_radio_button" =&gt; username}....)</code>.<br>
This behaviour shows that a <code>radio button</code> will not be treated as <code>form</code>’s <code>field</code>, so I have to handle errors manually, for example if we want to force the user to select one value from all <code>radio button</code>s and if he didn’ t an <code>error</code> shows : “you must select a username”, how we can do that ?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="283813" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/submitting-multi-inputs-types-in-phoenix-liveview/54942/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-283813" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="283813"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="283816" data-post-id="283816">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="codeanpeace" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/codeanpeace/120/10278_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  codeanpeace
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group quote-modified" data-username="Sidi_Mohammed" data-post="16" data-topic="54942">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/s/3da27b/48.png" class="avatar"> Sidi_Mohammed:</div>
<blockquote>
<p><code>&lt;input field = {@form[:username]} type = "radio"&gt;</code></p>
</blockquote>
</aside>
<p>Without prepending the <code>.</code> in <code>&lt;.input&gt;</code>, you won’t actually be calling the <code>input/1</code> function in your core components that appropriately nests the input field within the form.<br>
<a href="https://github.com/phoenixframework/phoenix/blob/f8c0ad26ee031ee87a6e7307f6dc1f7722134dd5/installer/templates/phx_web/components/core_components.ex#L264-L271" class="onebox" target="_blank" rel="noopener nofollow ugc">https://github.com/phoenixframework/phoenix/blob/f8c0ad26ee031ee87a6e7307f6dc1f7722134dd5/installer/templates/phx_web/components/core_components.ex#L264-L271</a></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="283816" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/submitting-multi-inputs-types-in-phoenix-liveview/54942/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-283816" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="283816"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #16"></div>
  </section>
</div>
    <div class="postbit" id="283817" data-post-id="283817">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Sidi_Mohammed" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Sidi_Mohammed
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/codeanpeace" rel="nofollow">@codeanpeace</a>, Iam sorry it was just a written mistake, of course I have used <code>&lt;.input&gt;</code> not <code>&lt;input&gt;</code>.<br>
now I just want to know how to show errors manually for an <code>&lt;.input&gt;</code> which will not be handled as <code>form</code>’s field</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="283817" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/submitting-multi-inputs-types-in-phoenix-liveview/54942/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-283817" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="283817"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>