function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RDN_LHRRDN_LHR 

Controller vs Standard Controller? or other easy way to save parameters?

I'm putting together a Visualforce page which is an edit mode page that collects some inputFields and creates a case.

 

I've gone the route of creating a controller and I've realised that I prefer the ease and benefits of the standard Case controller.

 

I have five or so fields that I want to hardcode values into and a few more that I'd like to populate with things like {!$CurrentPage.parameters.xxx} and {!$User.FirstName} {!$User.LastName}. 

 

I'd have thought from my light experience with S-Controls, that there'd be an easy way to assign these values to object fields directly in the page markup.  If there is some way, I'm missing it in all my reading.  All the examples I see of parameters and such are for getting them, not using them to set values.

 

So if you want to get these values values and write them to the object on Save, am I looking at only creating my own controller?  or maybe creating a controller extension?  If it's the latter, I can't seem to find good samples that speak to that either.

 

Can someone give me a fairly short answer to this?  Thanks!!

patrospatros

If I'm reading this right, it sounds like a controller extension for the Case object would be best way to go.

 

As far as getting and setting values, you need to look into the functionality of input fields, etc, as it sounds like you're missing some basic principles. Basically you need to add some inputfields for the fields you want to be editble, and define some getters and setters for those field values to talk to your controller. If you need to do no special processing on the data collected, the standard controller actions (save, cancel, delete) will work automatically.

 

Take a look at the Building a Controller Extension section of the Visualforce documentation. The example shown is a good place to start with controller extensions and inputFields.