Production version skips validation

I’m trying to validate_presence_of a hidden_field, which works fine on
my machine, but when I upload it to the production server (Apache
front-end running WEBrick behind) it skips validation every time. The
form field values are assigned with a javascript function, and then it
is submitted using javascript instead of a submit tag.

Controller:
def result
case @request.method
when :post
@result = Result.new(@params[‘result’])
if @result.save
flash[‘notice’] = “Evaluation Submitted”
redirect_back_or_default :action => “nextpt”
end
when :get
@result = Result.new
end
end

View:

                        <%= start_form_tag :action=> "result" %>
                        <%= hidden_field "result",

“DefinitionUseful” %>
<%= hidden_field ‘result’, ‘DefinitionComments’ %>
<%= hidden_field “result”, “SOPPUseful”
%>
<%= hidden_field ‘result’, ‘SOPPComments’ %>
<%= hidden_field “result”, “RIDeMResultUseful” %>
<%= hidden_field ‘result’, ‘RIDeMResultComments’ %>
<%= hidden_field ‘result’, ‘EvaluatorUserID’, :value=>
session[‘user’].UserID %>
<%= hidden_field ‘result’,
‘StudyPatientNumber’, :value=>@patient.PatientNumber %>
<%= end_form_tag %>

      <tr><td colspan="3" align="center"><input type="button"

value=“Submit and Continue” onclick=“submitForm();” />

Model:
class Result < ActiveRecord::Base
set_table_name “CCStudyResults”

validates_length_of :DefinitionUseful, :minimum => 5, :message =>
“seems to short”
end

I’m still pretty new at this. Any ideas? Thanks!!!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs