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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="jakub-zawislak" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jakub-zawislak/120/4104_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  jakub-zawislak
                    <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>Now is possible to use <code>embedded_schema</code> instead of <code>schema</code>, it means, there is no database requirement (but still Ecto is required).</p>
<p>I know that using embedded schemas in that way is kinda hack, so I’m not proud of it. But it was very easy to implement.</p>
<p>Example:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule App.Registration do
  use App.Web, :model

  embedded_schema do # instead of `schema "table_name"`
    field :email
    field :password
  end
end
</code></pre>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule App.RegistrationType do
  use Formex.Type

  def build_form(form) do
    form
    |&gt; add(:email, :text_input, label: "E-mail")
    |&gt; add(:password, :password_input, label: "Password")
    |&gt; add(:save, :submit, label: "Register")
  end
end
</code></pre>
<p>Controller</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def register(conn, %{"registration" =&gt; registration_params}) do
  RegistrationType
  |&gt; create_form(%Registration{}, registration_params)
  |&gt; handle_form # new function
  |&gt; case do
    {:ok, registration} -&gt;
      # do something with the `registration`
    {:error, form} -&gt;
      # display errors
      render(conn, "index.html", form: form)
  end
end
</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="28721" 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/formex-a-form-library-for-phoenix-inspired-by-symfony/3943/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-28721" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="28721"
                     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="39531" data-post-id="39531">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="jakub-zawislak" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jakub-zawislak/120/4104_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  jakub-zawislak
                    <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>I have published a new version of <a href="https://github.com/jakub-zawislak/formex" rel="noopener nofollow ugc">formex</a>.</p>
<p>Ecto related code is now extracted to a new library - <a href="https://github.com/jakub-zawislak/formex_ecto" rel="noopener nofollow ugc">formex_ecto</a>.<br>
Main library doesn’t have ecto dependency and can be used with standard structs.</p>
<p>Also, now is possible to use external validation libraries. For now there is support for <code>Vex</code> and <code>Ecto.Changeset.validate_*</code> (for those who wants to easily migrate old code which used Changeset’s validation <img src="https://forum.elixirforum.com/images/emoji/apple/smiley.png?v=15" title=":smiley:" class="emoji" alt=":smiley:" loading="lazy" width="20" height="20">) . <a href="https://hexdocs.pm/formex/Formex.Validator.html#available-adapters" rel="noopener nofollow ugc">Current list of supported libraries</a></p>
<p><a href="https://github.com/jakub-zawislak/formex/blob/master/UPGRADE.md" rel="noopener nofollow ugc">UPGRADE.md</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="39531" data-batch-url="/posts/batch_likers">
                        6
                      </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/formex-a-form-library-for-phoenix-inspired-by-symfony/3943/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-39531" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="39531"
                     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="39533" data-post-id="39533">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I don’t like templates and mixing elixir + html either. I want a separate ui, backend should not have knowledge about the client, ui should be usable with another backend (not elixir / phoenix I mean). I want simple maintenance of forms. So I looked for an opensource drag &amp; drop formbuilder, persisting screendefinitions in json. Of course the forms should be rendered runtime (eventually in development mode) from that same json. The idea is not quite new.<br>
I found something usable and reworked the javascript to work with websockets. So it communicates via phoenix channels with the backend now. Form defs are sent in json to the client, form input is sent to the server via the same channel.<br>
More about how I implemented client-side and serverside validations (with lots of advises against, hahaha )  : <a href="https://forum.elixirforum.com/t/code-eval-something/4267" class="inline-onebox" rel="nofollow">Code.eval_something</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="39533" 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/formex-a-form-library-for-phoenix-inspired-by-symfony/3943/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-39533" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="39533"
                     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="39535" data-post-id="39535">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>You seem to be getting mostly criticism in this thread for some reason, so let me say thank you. I appreciate the power that comes from a tool like 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="39535" data-batch-url="/posts/batch_likers">
                        13
                      </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/formex-a-form-library-for-phoenix-inspired-by-symfony/3943/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-39535" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="39535"
                     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="39536" data-post-id="39536">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="jakub-zawislak" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jakub-zawislak/120/4104_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  jakub-zawislak
                    <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>JSON + Websockets would be so 2017 <img src="https://forum.elixirforum.com/images/emoji/apple/smile.png?v=15" title=":smile:" class="emoji" alt=":smile:" loading="lazy" width="20" height="20"></p>
<p>I could create ability to return a form created in formex in JSON that would be sent to a client via Websocket.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="39536" 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/formex-a-form-library-for-phoenix-inspired-by-symfony/3943/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-39536" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="39536"
                     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="40178" data-post-id="40178">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>This is btw a demo of the formbuilder I’m using <a href="https://codepen.io/travist/full/xVyMjo/" rel="noopener nofollow ugc">https://codepen.io/travist/full/xVyMjo/</a>  (it has a link to github).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="40178" 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/formex-a-form-library-for-phoenix-inspired-by-symfony/3943/33">Post #32</a>
	                </div>
	            </div>
              <div id="likers-container-40178" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="40178"
                     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 #32"></div>
  </section>
</div>
    <div class="postbit" id="40306" data-post-id="40306">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I also come from the PHP/ Symfony world and I really appreciate your port of the form component. I will give it a try in my next project. <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="40306" 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/formex-a-form-library-for-phoenix-inspired-by-symfony/3943/34">Post #33</a>
	                </div>
	            </div>
              <div id="likers-container-40306" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="40306"
                     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 #33"></div>
  </section>
</div>
    <div class="postbit" id="57139" data-post-id="57139">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>As <a class="mention" href="/u/brightball" rel="nofollow">@brightball</a> said, people seem to be treating this library as a major software architecture statement and criticising it as such (not configured, not enough decoupling, single data source, etc). This is not supposed to be usable for everyone. This is a labor saving device <em>for the common case</em>, and should be treated as such. If one wants to save typing, <em>of course</em> it’s going to be limited, and coupled to the database and all those evil things. But in some cases, that’s exactly what the user wants <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<p>Personally I think this is very useful, and I’d like a complete CRUD layer, like Django Admin, or it’s Flask cousins (FlaskAdmin and FlaskAppBuilder), which which I’m most familiar (all python libraries).</p>
<p>To expand a little on this point, in <a href="https://flask-admin.readthedocs.io/en/latest/" rel="noopener nofollow ugc">FlaskAdmin</a> once you’ve defined your <code>User</code> and <code>Post</code> models (approximately the same as Ecto schemas), you can do this:</p>
<pre data-code-wrap="python"><code class="lang-python">from flask_admin.contrib.sqla import ModelView

# Initialize your app

admin = Admin(app, name='...', template_mode='bootstrap3')
admin.add_view(ModelView(User, db.session))
admin.add_view(ModelView(Post, db.session))
</code></pre>
<p>And get this for free: <a href="http://examples.flask-admin.org/sqla/simple/admin/user/" rel="noopener nofollow ugc">http://examples.flask-admin.org/sqla/simple/admin/user/</a></p>
<p>Yes, it’s extremely coupled to your database. Yes, it’s not very easy to customize. Yes, it supports only a single data source. Yes, it requires an ORM where it’s not easy to predict when the DB is queried (not that much harder than Ecto if you know what you’re doing; if you don’t it might be bad). Yes, you don’t have websockets because Python. Yes, route matching in Flask is very hard to predict (<a href="https://docs.pylonsproject.org/projects/pyramid/en/latest/designdefense.html#application-programmers-don-t-control-the-module-scope-codepath-import-time-side-effects-are-evil" rel="noopener nofollow ugc">really</a>; the author explains the problem with another framework but all that applies to Flask). Yes black magic happens behind the scenes. But with about THREE lines of code I get a functional admin backend.</p>
<p>Formex is not supposed to help you write Facebook (you should use PHP for that, of course), it’s supposed to help you write FlaskAdmin.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="57139" data-batch-url="/posts/batch_likers">
                        7
                      </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/formex-a-form-library-for-phoenix-inspired-by-symfony/3943/35">Post #34</a>
	                </div>
	            </div>
              <div id="likers-container-57139" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="57139"
                     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 #34"></div>
  </section>
</div>
    <div class="postbit" id="57140" data-post-id="57140">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>If you’re willing to render the forms on the client, maybe VueJS would be a good option. More, if you’re willing to compile the form templates on the client wuth VueJS’s compiler, this could be done. I’m not sure it’s worth it though. For simple forms, you can do most work on the server, and for complex forms you might want to design the whole thing in Javascript.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="57140" 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/formex-a-form-library-for-phoenix-inspired-by-symfony/3943/36">Post #35</a>
	                </div>
	            </div>
              <div id="likers-container-57140" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="57140"
                     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 #35"></div>
  </section>
</div>
    <div class="postbit" id="57158" data-post-id="57158">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="jakub-zawislak" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jakub-zawislak/120/4104_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  jakub-zawislak
                    <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>I thought about something that would return form inputs etc. in JSON to use it in Vue/React/Elm<br>
But in my every React app I have max several inputs so why I would use Formex here. My admin panels however are always in simple HTML rendered on backend. Like in the old days <img src="https://forum.elixirforum.com/images/emoji/apple/smiley.png?v=15" title=":smiley:" class="emoji" alt=":smiley:" loading="lazy" width="20" height="20"> So I don’t need such JSON functionality yet</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="57158" 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/formex-a-form-library-for-phoenix-inspired-by-symfony/3943/37">Post #36</a>
	                </div>
	            </div>
              <div id="likers-container-57158" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="57158"
                     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 #36"></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/3943/load_more?page=3">Load more posts (23 remaining)</a>
</div></template></turbo-stream>