473,654 Members | 3,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3487
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
40716
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 style="display:none"> can be displayed by setting the style attribute to "display:", or hidden with "display:none". This gives the illusion that the person filling out the form is switching from page to page...without the overhead of extra hits on the server,...
3
2566
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 to copy values from two INPUT controls that are located within the Form1 section to hidden INPUT controls located in the SignInForm and post the SignInForm form hidden controls values to a different page (e.g login.aspx) Problem is that after...
6
2997
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 (miRS.next()) {
4
11705
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 /><br /> <asp:Button ID="BtnSubmit" runat="server" OnClick="BtnSubmit_Click" Text="Submit" ValidationGroup="submitStates" /> <asp:RequiredFieldValidator ID="RequiredFieldValidator1"
0
2069
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 answered before. I have a cgi program in Python that genereates an HTML page with a form with hidden fields whose values are set via the following: ##Print hidden "usernameH", "passwordH", "timeH", "checksumH", and toPageH, fields with value attribs...
1
3655
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" onsubmit="return listBoxContents(this.Form.sel1)" action="project_selection.php" method="post">
11
7407
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 is not reset to '0' when i push the reset button. If I simply change the node from "<input type="hidden" id='IsChanged' value='0'>" to "<input type="text" id='IsChanged' value='0'>" Everything is working as expected (the value is reset to '0'...
5
7336
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 placed this function on my submission button when clicked. <input name="button5" type="button" class="Buttons" id="button5" value="On File" OnClick="setup_req('cpr_onfile',1);"/> <input type="hidden" name="cert_onfile"/> ..... <cfform...
6
1848
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 submit button that requires clicking. I have a form that, when processed by a Perl CGI script, sends back a 'Thankyou' message to the user, and I then want to tell the user that in a few seconds he will be taken to the next stage of the process,...
0
8379
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8709
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8596
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2719
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1597
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.