this repo has no description
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

use - as subform name separator

since . has to be escaped to use it in CSS for ids.

+19 -19
+3 -3
formz/src/formz.gleam
··· 708 708 fn add_prefix_to_item(item: Item(widget), prefix: String) -> Item(widget) { 709 709 case item { 710 710 Field(item_details, state, widget) -> { 711 - let new_name = prefix <> "." <> item_details.name 711 + let new_name = prefix <> "-" <> item_details.name 712 712 Field(item_details |> set_name(new_name), state, widget) 713 713 } 714 714 ListField(item_details, states, limit_check, widget) -> { 715 - let new_name = prefix <> "." <> item_details.name 715 + let new_name = prefix <> "-" <> item_details.name 716 716 ListField(item_details |> set_name(new_name), states, limit_check, widget) 717 717 } 718 718 SubForm(item_details, sub_items) -> { 719 - let new_name = prefix <> "." <> item_details.name 719 + let new_name = prefix <> "-" <> item_details.name 720 720 SubForm(item_details |> set_name(new_name), sub_items) 721 721 } 722 722 }
+9 -9
formz/test/formz_test.gleam
··· 250 250 251 251 f2 252 252 |> formz.data([ 253 - #("name.a", "1"), 254 - #("name.b", "2"), 255 - #("name.c", "3"), 253 + #("name-a", "1"), 254 + #("name-b", "2"), 255 + #("name-c", "3"), 256 256 #("d", "4"), 257 257 ]) 258 258 |> formz.decode ··· 402 402 403 403 f2 404 404 |> formz.data([ 405 - #("name.a", "a"), 406 - #("name.b", "2"), 407 - #("name.c", "3"), 405 + #("name-a", "a"), 406 + #("name-b", "2"), 407 + #("name-c", "3"), 408 408 #("d", "4"), 409 409 ]) 410 410 |> formz.decode ··· 419 419 420 420 f2 421 421 |> formz.data([ 422 - #("name.a", "1"), 423 - #("name.b", "2"), 424 - #("name.c", "3"), 422 + #("name-a", "1"), 423 + #("name-b", "2"), 424 + #("name-c", "3"), 425 425 #("d", "a"), 426 426 ]) 427 427 |> formz.decode
+2 -2
formz_string/birdie_snapshots/subform.accepted
··· 1 1 --- 2 2 version: 1.2.4 3 3 title: subform 4 - file: ./test/formz_string/simple_test.gleam 4 + file: ./test/formz_string/generator_test.gleam 5 5 test_name: subform_test 6 6 --- 7 - <div class="formz_items"><div class="formz_field"><label for="a">A: </label><input type="number" name="a" id="a" required></div><fieldset><legend id="b_legend">B: </legend><div><div class="formz_field"><label for="b.a">A: </label><input type="number" name="b.a" id="b.a" required></div><div class="formz_field"><label for="b.b">B: </label><input type="number" name="b.b" id="b.b" required></div><div class="formz_field"><label for="b.c">C: </label><input type="number" name="b.c" id="b.c"></div></div></fieldset></div> 7 + <div class="formz_items"><div class="formz_field"><label for="a">A: </label><input type="number" name="a" id="a" required></div><fieldset><legend id="b_legend">B: </legend><div><div class="formz_field"><label for="b-a">A: </label><input type="number" name="b-a" id="b-a" required></div><div class="formz_field"><label for="b-b">B: </label><input type="number" name="b-b" id="b-b" required></div><div class="formz_field"><label for="b-c">C: </label><input type="number" name="b-c" id="b-c"></div></div></fieldset></div>
+2 -2
formz_string/birdie_snapshots/subform_with_help_text.accepted
··· 1 1 --- 2 2 version: 1.2.4 3 3 title: subform with help text 4 - file: ./test/formz_string/simple_test.gleam 4 + file: ./test/formz_string/generator_test.gleam 5 5 test_name: subform_with_help_text_test 6 6 --- 7 - <div class="formz_items"><div class="formz_field"><label for="a">A: </label><input type="number" name="a" id="a" required></div><fieldset aria-describedby="b_help_text"><legend id="b_legend">B: </legend><p id="b_help_text" class="formz_help_text">this is subform b</p><div><div class="formz_field"><label for="b.a">A: </label><input type="number" name="b.a" id="b.a" required></div><div class="formz_field"><label for="b.b">B: </label><input type="number" name="b.b" id="b.b" required></div><div class="formz_field"><label for="b.c">C: </label><input type="number" name="b.c" id="b.c"></div></div></fieldset></div> 7 + <div class="formz_items"><div class="formz_field"><label for="a">A: </label><input type="number" name="a" id="a" required></div><fieldset aria-describedby="b_help_text"><legend id="b_legend">B: </legend><p id="b_help_text" class="formz_help_text">this is subform b</p><div><div class="formz_field"><label for="b-a">A: </label><input type="number" name="b-a" id="b-a" required></div><div class="formz_field"><label for="b-b">B: </label><input type="number" name="b-b" id="b-b" required></div><div class="formz_field"><label for="b-c">C: </label><input type="number" name="b-c" id="b-c"></div></div></fieldset></div>
+2 -2
formz_string/birdie_snapshots/subform_with_help_text_and_error.accepted
··· 1 1 --- 2 2 version: 1.2.4 3 3 title: subform with help text and error 4 - file: ./test/formz_string/simple_test.gleam 4 + file: ./test/formz_string/generator_test.gleam 5 5 test_name: subform_with_help_text_and_error_test 6 6 --- 7 - <div class="formz_items"><div class="formz_field"><label for="a">A: </label><input type="number" name="a" id="a" required></div><fieldset aria-describedby="b_help_text"><legend id="b_legend">B: </legend><p id="b_help_text" class="formz_help_text">this is subform b</p><div><div class="formz_field"><label for="b.a">A: </label><input type="number" name="b.a" id="b.a" required aria-describedby="b.a_error"><span id="b.a_error" class="formz_error">woops</span></div><div class="formz_field"><label for="b.b">B: </label><input type="number" name="b.b" id="b.b" required></div><div class="formz_field"><label for="b.c">C: </label><input type="number" name="b.c" id="b.c"></div></div></fieldset></div> 7 + <div class="formz_items"><div class="formz_field"><label for="a">A: </label><input type="number" name="a" id="a" required></div><fieldset aria-describedby="b_help_text"><legend id="b_legend">B: </legend><p id="b_help_text" class="formz_help_text">this is subform b</p><div><div class="formz_field"><label for="b-a">A: </label><input type="number" name="b-a" id="b-a" required aria-describedby="b-a_error"><span id="b-a_error" class="formz_error">woops</span></div><div class="formz_field"><label for="b-b">B: </label><input type="number" name="b-b" id="b-b" required></div><div class="formz_field"><label for="b-c">C: </label><input type="number" name="b-c" id="b-c"></div></div></fieldset></div>
+1 -1
formz_string/test/formz_string/generator_test.gleam
··· 102 102 pub fn subform_with_help_text_and_error_test() { 103 103 one_field_and_subform_form() 104 104 |> formz.update_config("b", formz.set_help_text(_, "this is subform b")) 105 - |> formz.field_error("b.a", "woops") 105 + |> formz.field_error("b-a", "woops") 106 106 |> generator.build 107 107 |> birdie.snap(title: "subform with help text and error") 108 108 }