x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<form action="/" accept-charset="UTF-8" method="post"><input type="hidden" name="authenticity_token" value="r9luT0zHq_GE90A3SkCQDRvzzYs2JhLvIZd5vNZ-s670j8owGB45EpIzyUgqPA7TviDoK5nkIlLMCJ0G4dfgNA" autocomplete="off" /> <div class="space-y-4" x-data x-init="Alpine.store('favorite_fruits', 'banana');"> <label class="label block " for="form_component_preview_test_model_favorite_fruits">Favorite fruits</label> <select x-model="$store.favorite_fruits" name="form_component_preview_test_model[favorite_fruits]" id="form_component_preview_test_model_favorite_fruits"><option value="orange">Orange</option> <option selected="selected" value="banana">Banana</option> <option value="apple">Apple</option></select> </div> <div x-data="{condition: false}" x-effect="condition = $store.favorite_fruits === 'banana' || (Array.isArray($store.favorite_fruits) && $store.favorite_fruits.includes('banana'))"> <p class="sr-only" aria-live="polite" role="status" x-text="'Followup banana question is now ' + (condition ? 'visible' : 'hidden')"> </p> <div x-cloak x-show="condition" class="space-y-4"> <h2>Header</h2> <p>Body</p> </div> </div></form>1
2
custom_model = TestModel.new(favorite_fruits: "banana")render("non_component_previews/prefilled_dropdown_conditional", model: custom_model)No notes provided.
No params configured.