I want to make a form for submitting the info needed to create an instance of model X and save it to the database, but I have a slight problem: I know how to add form fields like text areas and what not and then how to make those values accessible when the create method is called, but what if I want to also send make a value that is not part of the form accessible? For example, what if I want to be able to access some text in a <div> of my html document and send that to the create method for model X (so it can be stored in like a content variable or something)? How do I do that?
I want to make a form for submitting the info needed to create an
Share
Short answer is you can’t – to send data to the server, it has to be in an form field.
Longer answer – there are ways around this and you have several options – put the text in a textarea and style it to look like an div, or put it in a hidden field when the template is created, or use javascript to copy it into a hidden field … all depends on what you are trying to do really. Perhaps you could give some more detail?