473,385 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Add hidden fields to form onSubmit

I would like to add a few hidden field values to a form as it is
submited via JavaScript.

I have a static page shopping site that uses MIVA shopping cart. Some
of the pages are getting quite large and I want to start reducing the
amount of code on each page. Replacing tables with divs are helping
some but not as much as I would like.

Some pages may have up to 100 different items on it and each one has
its own form for submitting the item to MIVA (add to cart). Each form
has 4 hidden fields that are the same for every item and only one
hidden field plus the numbr of items textfield that changes.

I want to place all the hidden fields in one javascript function so I
only have to place the item number hidden field and the number of
items textfield in each product's form and the Add to Cart button
would call the javascript function. The javascript function would add
the generic hidden fields and then submit the form.

I've looked everywhere for how this can be done. Any ideas of
tutorials. Typical page in question can be seen at:
http://www.sunburstbottle.com/Merchant2/cat2.html

Thanks
Jul 23 '05 #1
1 3466
Ivo
"Sam Wuebben" wrote:
I would like to add a few hidden field values to a form as it is
submited via JavaScript.
After looking at your site, and before putting in more energy, frankly, this
not a good idea. You don't want to miss those without javascript.
I have a static page shopping site that uses MIVA shopping cart. Some
of the pages are getting quite large and I want to start reducing the
amount of code on each page. Replacing tables with divs are helping
some but not as much as I would like.

Some pages may have up to 100 different items on it and each one has
its own form for submitting the item to MIVA (add to cart). Each form
has 4 hidden fields that are the same for every item and only one
hidden field plus the numbr of items textfield that changes.

I want to place all the hidden fields in one javascript function so I
only have to place the item number hidden field and the number of
items textfield in each product's form and the Add to Cart button
would call the javascript function. The javascript function would add
the generic hidden fields and then submit the form.

I've looked everywhere for how this can be done. Any ideas of
tutorials. Typical page in question can be seen at:
http://www.sunburstbottle.com/Merchant2/cat2.html


document.forms.length returns 92 there. I would suggest setting up a system
which one form for all items.
HTH
Ivo
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div...
3
by: Itai | last post by:
I have an aspx file named index.aspx which contains two ‘form' sections, one that has the runat=server attribute (e.g From1) and one which is a regular HTML form (e.g SignInForm). I am trying...
6
by: Omar | last post by:
Hi, In a JSP I have the next: .... codigo = "<select name='" + nombre + "'>\n<option selected value='default'>Escoge</option><option value='todos'>Todos</option>"; if (miRS != null) while...
4
by: WB | last post by:
Hi, I need to validate a hidden input in my webform to ensure that it's got value. The controls look something like this: <input id="HidSelectedStates" type="hidden" runat="server" /><br...
0
by: BcNexus | last post by:
Hello all, The search function of this forum isn't working although I found a similar question on the forum using Google, but the replies don't help me. So, forgive me please if this has been...
1
by: tks423 | last post by:
Hi, On submitting the form, I'm trying to place the items of a listbox in a hidden input. It doesn't work. Is my approach correct? I have a form like this: <form name="myForm"...
11
by: newbie | last post by:
i have a form in which a hidden field (initial value as '0', and my javascript set it to '1' when an event is trigged). In the same form, i have a reset field. But I realized that the hidden field...
5
by: dmorand | last post by:
I'm having a strange issue with a form I'm developing. I'm saving some values to hidden fields when a user clicks a button. I setup a function which gets ran on submission of the form, but I also...
6
by: Graham | last post by:
I have long thought there is something missing with HTML forms, in that there should be a provision for a form with hidden input fields, with the whole form being hidden, in particular with no...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.