← Back to Upcase

A model for forms?

(Scott Hollinshead) #1

I want to create some forms, but the forms will be different for different companies.

So It will have a main page with some images on of the different companies and then when they click on the image, It will take them to a form fit for that company.

So my question is am I better off creating a Company model for the company names and then a Form model for all of the forms and form data?


(Chad Pytel) #2

@scott how are the forms differ for each company and will they change often? Also, will new companies be added and removed often?

Does a non programmer need to be able to make changes to the companies and forms?

(Scott Hollinshead) #3

@cpytel The forms have different information on specific to that company.

Once the form is done It shouldn’t need changing, but new companies will be added.

A non programmer will not need to make any changes, just fill in the forms.

(Chad Pytel) #4

@scott what do you mean by different information for each company. Please provide specific information, it matters to the potential solution.

(Scott Hollinshead) #5

@cpytel Some forms require vehicle check information, some require engineer specifications and checks, and some require job instructions, and some require all of what I have just mentioned.

(Chad Pytel) #6

“vehicle check information, some require engineer specifications and checks, and some require job instructions”

@scott, I don’t know what any of these things are.

Do you have a user interface, wireframes, etc. that indicate what the actual functionality is? Ate they just text areas? Are they the same for all companies that require them? When you say “require” do you mean that it is just a validation difference, all companies have those fields but some require them and others don’t, or is it that they don’t have those fields at all.

(Chad Pytel) #7

Also, what is the name of the model or resource that the form is submitting to?

(Scott Hollinshead) #8

@cpytel They are just text fields that will change to cater for the information needed. When I say require I mean that the company that the form has to be filled out for needs the information to process.

The employees all have iPads and they fill in these forms when they are on a job.

So they will fill in the form and submit it, and then the people in the office will print them off.

I haven’t started this yet so I don’t have any Models, before I started I wanted to know the best way to approach it.

So my thought was to have a Company Model that is linked to different forms, so I was going to call the other Model Form and have it submit there.

(Chad Pytel) #9

What do the people who use this call these things? That should be the model name.

Do you have a wireframe?

(Scott Hollinshead) #10

@cpytel They call them Job sheets, and I have a sample of the Form in excel?

(Chad Pytel) #11

Ok, thanks for the details. Feel free to post a screenshot of the excel form.

It sounds to me like you don’t need multiple forms at all, but rather, one form that has a few fields hidden or shown (or included or not included) on it depending on the behavior of the company?

To me, this would be a JobSheet model (and corresponding form) which basis its behavior on the company that it is for.

Let me know if any of that is not clear or I’ve gotten something wrong.


(Scott Hollinshead) #12

@cpytel Thanks for your help, the only thing I don’t understand is how I can base the form on the behaviour of the particular company.

(Chad Pytel) #13

The view will check the JobSheet or Company to determine what fields should be included.

(Scott Hollinshead) #14

@cpytel Oh right, so I’m still having the 2 models Company and Jobsheet, so I would just do belongs_to :companyon the JobSheet model and has_one :job_sheet on the Company model?

Thanks again Chad!

(Chad Pytel) #15

Yup, thats correct.