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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Oh!</p>
<p>I am trying to do exactly this in the future. But couldn’t you have a LiveView template conditionally render another template inside of it? Haven’t tried this yet but will be crossing this bridge soon.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="127782" 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/liveview-phx-change-attribute-does-not-emit-event-on-input-text/21280/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-127782" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="127782"
                     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="127784" data-post-id="127784">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="Owens" data-post="12" data-topic="21280">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/owens/48/11597_2.png" class="avatar"> Owens:</div>
<blockquote>
<p>I am trying to do exactly this in the future. But couldn’t you have a LiveView template conditionally render another template inside of it? Haven’t tried this yet but will be crossing this bridge soon.</p>
</blockquote>
</aside>
<p>You can conditionally render all you want as it is right now, but the backend functionality has to support everything you potentially want to do, whether actually using it or not, instead of allowing the system itself to manage it.  It’s the main feature I’m waiting for liveview as my server design is integrally tied into the drab subcommander style of piecing things together (which I <em>adore</em> as it works really really well!), plus some other features like more fine-grained control of the page that liveview does not allow for yet without some really convoluted work-arounds that don’t fit even remotely easy, but is trivial in drab.  ^.^;</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="127784" data-batch-url="/posts/batch_likers">
                        2
                      </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/liveview-phx-change-attribute-does-not-emit-event-on-input-text/21280/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-127784" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="127784"
                     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="135679" data-post-id="135679">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>This is a massive bummer. I have a really, really big form with one country select in the middle. Based on the selected country, I want to display something differently. I do absolutely NOT want a phx-change on my form (massive amount of data on the wire (textareas with tens of thousands of words)), I just want a phx-submit. How do I detect the changes to just my country select? Doesn’t seem like I can nest forms either.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="135679" data-batch-url="/posts/batch_likers">
                        5
                      </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/liveview-phx-change-attribute-does-not-emit-event-on-input-text/21280/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-135679" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="135679"
                     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="136423" data-post-id="136423">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hi <a class="mention" href="/u/ryan-senn" rel="nofollow">@ryan-senn</a>,</p>
<p>first of all, welcome to the Elixir Forum! I do have the same issue – I want finer-grained control. Right now, I <em>abuse</em> the phx-keyup in conjunction with phx-focus and phx-value to achive the desired function:</p>
<p>phx-focus will send the currently focused input element identified by the value in phx-value /some index). The value of the input field itself will be send on each keyup event.</p>
<p>See <a href="https://github.com/gutschilla/phoenix-liveview-todo-app/blob/master/lib/live_demo_web/views/page_view.ex" class="inline-onebox" rel="noopener nofollow ugc">phoenix-liveview-todo-app/lib/live_demo_web/views/page_view.ex at master · gutschilla/phoenix-liveview-todo-app · GitHub</a> for an example.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="136423" 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/liveview-phx-change-attribute-does-not-emit-event-on-input-text/21280/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-136423" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="136423"
                     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="136455" data-post-id="136455">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks for your answer. I’ve read about a few other people (ab)using keyups to suit their needs.</p>
<p>The input that I want to listen to is a select and not a text input however (I assume no keyup?). I haven’t actually tried to dig deeper just yet, the app we’re developing won’t be released for another 2 months, making it a not so urgent situation.<br>
I mainly wanted to share my use case to demonstrate that input level changes can be beneficial in some circumstances. I just intuitively assumed that it was an option, so it was quite a surprise to find out that it isn’t. Maybe because of previous experience with elm/react etc.</p>
<p>Thanks again for your example, it’s an interesting trick. I’m sure it will help out quite a few people searching how to do this!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="136455" data-batch-url="/posts/batch_likers">
                        2
                      </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/liveview-phx-change-attribute-does-not-emit-event-on-input-text/21280/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-136455" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="136455"
                     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="139307" data-post-id="139307">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Sorry to resurect old topic but I have question about how the combination of <code>keyup</code>, <code>focus</code> and <code>value</code> work.</p>
<p>I still don’t understand which event does what?<br>
I’ve learned that <code>phx-change</code> cannot overwrite the value in a focused text input. Is the <code>phx-focus</code> somehow mitigating 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="139307" 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/liveview-phx-change-attribute-does-not-emit-event-on-input-text/21280/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-139307" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="139307"
                     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="151682" data-post-id="151682">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I think this is my biggest current wish for LiveView as well in terms of supporting composable forms.</p>
<p>With the awesome new <code>live_component</code> setup, it has become much easier to compose LiveViews. But, this feels hobbled by the current JS interop that requires handling forms as a single unit (without going all JS hooky). Some kind of override allowing one to manipulate input values <em>outside</em> of phx_submit would be especially helpful for me.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="151682" 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/liveview-phx-change-attribute-does-not-emit-event-on-input-text/21280/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-151682" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="151682"
                     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 #17"></div>
  </section>
</div>
    <div class="postbit" id="151689" data-post-id="151689">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Agree… I love the new live_components.  I am using them extensively!</p>
<p>You can manipulate input values of any non-focused fields without using hooks by using <code>phx-change</code>.  By default your <code>handle_event</code> will fire on every keystroke but you can use <code>phx-debounce</code> to have it fire after x ms or onBlur.  In your handler you can feed the params into your form’s changeset function (which has all the validations), <code>put_change</code> any manipulations to non-focused fields, then generate a new form struct running <code>form_for</code> on the changeset.  Then you just put the new form struct into your assigns and you should be good to go!</p>
<p>Mutating focused fields (like masked inputs and the like) I’m pretty sure you do need to use hooks probably due to latency and race conditions.  You can do it with vanilla JS as shown in the docs but I like to use phoenix_live_react.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="151689" data-batch-url="/posts/batch_likers">
                        3
                      </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/liveview-phx-change-attribute-does-not-emit-event-on-input-text/21280/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-151689" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="151689"
                     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 #18"></div>
  </section>
</div>
    <div class="postbit" id="173783" data-post-id="173783">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hi,</p>
<p>what solution did you come up with?<br>
I am on the same question… using <strong>select</strong> so cannot use keyup event.</p>
<p>better scenario…<br>
how to choose state then choose city then region.<br>
select box to choose state then show options for list of available cities.</p>
<p>list of states and list of cities will not be a part of changeset. but selected_city_id and selected_region_id will be.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir"># My LiveComponent

  def render(assigns) do

    ~L"""
    &lt;div class="input-box"&gt;
    &lt;%= select(@opts.form_handle, :select_id, @opts.city_pairs, phx_window_keydown: "city_selected") %&gt;
    &lt;span class="error-msg"&gt;
    &lt;%#= error_tag @opts.form_handle, @opts.select_id %&gt;
    &lt;/span&gt;
    &lt;/div&gt;
    """
  end

  def handle_event(msg, params, socket) do
    IO.puts "city selected .........................."
    {:noreply, socket}
  end

  def handle_event("city_selected", %{"landmark" =&gt; landmark_params}, socket) do
    IO.puts "city selected .........................."
    # IO.puts inspect(params)
    {:noreply, socket}
  end

# it straight goes to form event...

</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="173783" 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/liveview-phx-change-attribute-does-not-emit-event-on-input-text/21280/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-173783" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="173783"
                     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 #19"></div>
  </section>
</div>
    <div class="postbit" id="173787" data-post-id="173787">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="chrismccord" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chrismccord/120/24233_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  chrismccord
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Phoenix</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>the params will contain a <code>"_target"</code> which is the name of the form field which triggered the change, so you can use that to handle the city =&gt; state =&gt; etc flow</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="173787" data-batch-url="/posts/batch_likers">
                        2
                      </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/liveview-phx-change-attribute-does-not-emit-event-on-input-text/21280/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-173787" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="173787"
                     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 #20"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/21280/load_more?page=3">Load more posts</a>
</div></template></turbo-stream>