How can I call a method about a form?
I have 3 radio buttons and I want to call a method depending on which radio button is checked. After the call I have to return the controller a variable to the view.
How can I do that?
My approach:
I want use CSS do design my HTML. That is the reason why I haven't used a form helper:
<div id="cx" class="cxs">
<form>
<fieldset>
<label>
<input type="radio" id="cxId" name="checkBox"> ID
</label>
<label>
<input type="radio" id="cxName" name="checkBox"> Name
</label>
<label>
<input type="radio" id="cxArtikelnummer" name="checkBox"> Artikelnummer
</label>
</fieldset>
<button type="button" id="cxBtn">Ok</button>
</form>
</div>
Here I want to call a method depending on which radio button is checked (show by name, id or artikelnummer).
I have solved it stati, but the choose have to be dynamic and I thought do that with methods.
<% $i = 0 %>
<% $num = @title.count %>
<% @title.each do |row| %>
Name: <%= row["Name"] %>
Durchlauf: <%= $i %> <br>
<% $i += 1 %>
<% end %>
@title? where is it initialised?nameas yourmethod_name, and when selected you can call the corresponding method usingsend(method_name.to_sym).