473,698 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to keep created elements in javascript on reload

samikhan83
33 New Member
hi All Experts.... once again i am in some problem.......

i have a form which creates a new textbox elements when a new product is scanned with barcode scanner.

Problem is when i submit the form and check for server side validation if the form have some error according to validation it is going to the form again and all the generated textbox vanishes ... and i am loosing all the entered data and fields.

There is any way to keep the generated element intact with there respective data .

so please can anybody help me with this .

Waiting For Your Reply
Aug 25 '08 #1
4 2048
Dormilich
8,658 Recognized Expert Moderator Expert
as I understand it right, the barcode scanner fires a javascript event that creates the textbox, right?
in that case, the returning form (from the failed validation) misses that event and the standard form is returned. you can only prevent that by explicitly writing a new textbox through the server side script with the data as default value (and of course interrupting the barcode event as long as the validation process is not finished).

hope that helps a bit
Aug 25 '08 #2
samikhan83
33 New Member
Thanks For Your Reply....

i to thought of doing that ...... but is there anyway of caching the element and the values and reusing it .....

instead of regenerating all the elements again.... because it very complex form...

where form is for Purchase Invoice Entry of inventory system where user will scan product after product like multiple product with there serial number so
for each product upc code new elements with zero value price,quantity and serial number will be generate and each product have multiple serial number.....

so the form grow dynamically by getting the values from database with AJAX....

if there is any solution then highly APPRECIATED....
Aug 25 '08 #3
Dormilich
8,658 Recognized Expert Moderator Expert
i to thought of doing that ...... but is there anyway of caching the element and the values and reusing it .....
you might try to send the form element collection back as an AJAX request (I think you have to serialize, WDDX is worth looking at).
Expand|Select|Wrap|Line Numbers
  1. // general idea:
  2. var form = serialize(document.forms[0]);
  3. ...
  4. XMLhttpRequest.send(form);
Aug 25 '08 #4
samikhan83
33 New Member
yaah i will give it a try... i think it should work

thanx for your suggestion....
Aug 26 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
5574
by: Michael | last post by:
I am reading and setting a cookie using JavaScript in the BODY onload and onunload events respectively. This works fine. However when I use ASP to set the cookie under some condition where I want to override the last value set in the onunload event, it has no effect. The next onload still has the old value. Any ideas? The following code simulates the problem I experience. --------------------------------------------------
1
3189
by: Will | last post by:
Hi, I have a problem trying to validate dynamically created html form elements using javascript. I have dynamically created a check box using ASP for each record in a recordset and have given each a unique ID using the primary key from a db table. e.g "chk" + "1" for record 1 and "chk" + "2" for record 2 etc. This means each box is called chk1 and chk2 respectively. This works fine and changes dependant on the recordset used and allows me...
5
2434
by: Dani | last post by:
Hello everybody, I have some code that disables form elements on body load, but I notice when I hit the "back" button, I need to re-enable the form elements (that is done by clicking on a radial button). Is there any way I can keep the form for disabling every time a user hits the back button and "remember" what elements should be enabled? I was thinking maybe utilizing some referrer thing, but I'm not that good with JS yet. Thanks...
1
3131
by: CS Wong | last post by:
Hi, I have a page form where form elements are created dynamically using Javascript instead of programatically at the code-behind level. I have problems accessing the dynamically-created elements and would like to seek a solution for this. I had looked through several articles for accessing programatically-created dynamic elements such as: 1)
3
9239
by: nkoriginal | last post by:
Hello: I tried an script for keep my data form after reload page, but I've some errors. In this momento I runnung my own browser because we've an intranet. And for security reason, our page reload every 10 minutes for keep my login live. But, we've some forms, and 10 minutes is a shorcut time to do that, and very 10 minutos, our page reload, and we lose all data in form (before submit). So, for that reason , I want to keep my data after...
1
4024
by: nkoriginal | last post by:
Hello Again: I've a problem with my forms. I woking with an intranet, and the pages in that intranet, has a reload page, every 10 minutos. So my problems star, when any user stay in my forms for more longe than 10 minutes, and the page reload, the user lose all data in that forms, if he not did submit. I want to keep the user form data, after reload. Is that possible? so, en litle words, if the user stay in my forms and he filled...
3
1413
Ajm113
by: Ajm113 | last post by:
Ok for some reason after the update of Firefox it seems that my form keeps getting submitted when the user made a error on the form. I just want the page to reload so the user may try again. Because I have it so the submit button is a hit once only. Here is the code: <SCRIPT LANGUAGE="JavaScript"> function validateForm(form) { if (form.username.value == "")
5
1439
by: gyip | last post by:
My environment: IE7 browser hitting an ASP.NET webpage that uses Javascript to render the contents. This is not an ASP.NET problem but a Javascript problem that I am encountering. Problem: I am basically generating a menu which is essentially a TABLE within a DIV tag using Javascript. For some reason the table is not displaying. The DIV tag essentially has the dimensions of 0. What I have done:
0
8674
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
9157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9028
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...
1
8895
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7728
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4369
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...
2
2330
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
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.