Forum Moderators: open

Message Too Old, No Replies

Passing Multiple Variables in Form

Passing Variables in Form

         

Becca800

3:14 am on Oct 1, 2008 (gmt 0)

10+ Year Member



In a regular form with text fields, can I pass the imput from the user directly into a hidden textarea from multiple fields intertwined with html? Example:

<form>
<input type="text" name="firstname">
<input type="text" name="lastname">
<input type="text" name="occupation">
<input type="hidden" value="some html + firstname + some html + lastname + some html + occupation">
</form>

I think this might require some javascript. Is something like this possible?

vincevincevince

3:27 am on Oct 1, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, you can do that with javascript. The more important question is why you want to do it with javascript.

Your form handler is the best place to do form processing - the thing within <form action="?">. It should be able to access all of the form fields which were submitted and then combine them with HTML as required.

Becca800

3:33 am on Oct 1, 2008 (gmt 0)

10+ Year Member



Well, not in this case. This form is a joomla component created to submit content. The final textarea created will be deposited into the db table in one cell which creates the "article". For some reason, I can not use more than one, it has to be from one input. Actually, I don't really understand it all, so I don't know what else to do. I did not create the initial form, it is a component of Joomla, however I can modify the form. The initial form only gives one giant text box for the article which I user would upload. But I only want the user to enter pieces of info which will then be used to create the article with my own html. And this is the only way I know how to do this.