Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Question about Model fields you don't want on a form

Received: by 10.42.80.3 with SMTP id t3mr5093250ick.24.1349436911777;
        Fri, 05 Oct 2012 04:35:11 -0700 (PDT)
X-BeenThere: symfony2@googlegroups.com
Received: by 10.50.51.234 with SMTP id n10ls460096igo.3.canary; Fri, 05 Oct
 2012 04:35:08 -0700 (PDT)
Received: by 10.43.53.144 with SMTP id vq16mr4999910icb.26.1349436908902;
        Fri, 05 Oct 2012 04:35:08 -0700 (PDT)
Received: by 10.50.0.146 with SMTP id 18msige;
        Thu, 4 Oct 2012 21:30:19 -0700 (PDT)
Received: by 10.68.232.230 with SMTP id tr6mr2859476pbc.16.1349411418987;
        Thu, 04 Oct 2012 21:30:18 -0700 (PDT)
Date: Thu, 4 Oct 2012 21:30:18 -0700 (PDT)
From: John Webb <vap...@gmail.com>
To: symfony2@googlegroups.com
Message-Id: <05ae3645-1321-456d-8537-b10d269ce649@googlegroups.com>
Subject: Question about Model fields you don't want on a form
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_185_19544868.1349411418461"

------=_Part_185_19544868.1349411418461
Content-Type: multipart/alternative; 
	boundary="----=_Part_186_26276487.1349411418461"

------=_Part_186_26276487.1349411418461
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

I'm working on a project where I have a model's data loaded from a form, 
but some of the fields on the model are calculated from submitted 
information.  A simple example would be an Update field that takes a time. 
 I want this field to be NotBlank in the DB, so I set that Annotation on 
the model, but this causes the form to throw an error if I don't specify 
it, when I really want to just set it myself after the form is bound and 
validated.

Is there a good way to set this up with just a single model, or would it 
require making an additional sort of 'Input Model', validating that, then 
mapping it over after and persisting my original model with the new data?

------=_Part_186_26276487.1349411418461
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

I'm working on a project where I have a model's data loaded from a form, but some of the fields on the model are calculated from submitted information. &nbsp;A simple example would be an Update field that takes a time. &nbsp;I want this field to be NotBlank in the DB, so I set that Annotation on the model, but this causes the form to throw an error if I don't specify it, when I really want to just set it myself after the form is bound and validated.<div><br></div><div>Is there a good way to set this up with just a single model, or would it require making an additional sort of 'Input Model', validating that, then mapping it over after and persisting my original model with the new data?</div>
------=_Part_186_26276487.1349411418461--

------=_Part_185_19544868.1349411418461--