I need to render a javascript file to display an alert box when the user doesn't fill out any part of the form. The form will not save until all the inputs are filled. I tried many different combinations and I feel like I'm further from a solution.
def create
@question = Question.new(question_params)
if @question.save
redirect_to new_question_share_quiz_path(@question)
else
respond_to do |format|
format.js { render :action => "try" }
end
end
end
And the try.js file is in the views folder.
The try.js file only has one line of code
alert("You need to fill out the whole form");