girishramnani / polly

A social poll application
MIT License
45 stars 5 forks source link

Edit poll with options fix #12

Closed Gaurav1924 closed 1 month ago

Gaurav1924 commented 1 month ago

Phoenix.HTML.Form.input_value/2 -> Updated all occurrences where field names are used in inputs_for, input, and other form-related functions to use atoms.

Assign :form in handle_params:

Original: The form assignment was missing in the handle_params function. Updated: In the handle_params function, the form is now assigned using the to_form(changeset) function along with poll and changeset.

Redirect Path in handle_event("save"): Original: Routes.poll_path(socket, :index) was incorrect. Updated: Changed poll_path to poll_index_path for correct redirection after saving the poll.

Form Usage in render Function: Original: Incorrect usage of @changeset in the form rendering part. Updated: Changed @changeset to @form for correctly rendering the form.

Input Field Naming in Form: Original: Incorrect usage of dynamic field values in the input fields. Updated: Used Phoenix.HTML.Form.input_value(@form, :field_name) to correctly set values for the input fields in the form.

Button Target in add-option Event: Original: phx-target={@myself} was used which is unnecessary. Updated: Removed phx-target attribute from the "Add" button in the form.

Fixes #12