473,394 Members | 1,879 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,394 software developers and data experts.

Using JavaScript to change form values

Hey guys,
im working on a project right now that has a form that needs to be filled out by applicants. Applicants also can go back later once the form has been submitted and edit the form if changes need to be made. My problem lies in the fact that i dont want to duplicate the web page for the two different cases of the form being empty and the form being filled with the pre-existing info in the database.

Im using ASP and am having no problem checking whether or not the record exists and getting the necessary info to fill the form. However, im not sure how to correctly place the values in the form.


Normally I would have a Javascript function with a bunch of:
FormName.FieldName.value = "valuefrom database";

But the problem is the fieldnames and number of fields need to be dynamic because the database is changing constantly. The form itself adjusts to the changes in the database already so that part is fine.

Here is the basic idea of what im looking to do but i have no idea how to actually do it! below clearly does not work!

Expand|Select|Wrap|Line Numbers
  1. function updateform(fieldname,DBvalue){
  2.        FormName.fieldname.value = DBValue;
  3. }
  4.  
If anyone can help me out it would be greatly appericiated!!
Thanks!!
Jan 21 '09 #1
2 1451
gits
5,390 Expert Mod 4TB
try:

Expand|Select|Wrap|Line Numbers
  1. FormName[fieldname].value
kind regards
Jan 21 '09 #2
Thank you!
Miles
Jan 22 '09 #3

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

Similar topics

1
by: Xeon | last post by:
Ok, the subject seemed not PHP related, but it does, as the submitted form will be read/processed by PHP. I have this HTML code: <form method="post" action="foo.php"> <select name="blah"...
2
by: sh0t2bts | last post by:
I have multiple text fields in my page called Con_Hours0 Old_Con_Hours0 Con_Hours1 Old_Con_Hours1 Con_Hours2 Old_Con_Hours2 Con_Hours3 ...
6
by: Bonge Boo! | last post by:
This has got to be obvious, but I can't make it work. I have a form called with 3 pull down menus. They are linked to a database which generates the values for the <SELECT? Pull-downs. Lets...
6
by: Daz | last post by:
Hi everyone. Firstly, I apologise if this i not what you would call a PHP problem. I get quite confused as to what lives in which realm, so if this shouldn't be posted here, please suggest where...
4
by: frank78 | last post by:
Hi all, I'm having an issue with passing form values from one page to the next. I wrote a function that I use to change the value of a hidden field to any number of dynamically generated form...
2
by: shivendravikramsingh | last post by:
hi friends, i m using a ajax function for retrieving some values from a database table,and display the values in required field,my prob is that the ajax function i m using is working f9 once,but if...
1
by: sudip2008 | last post by:
When using the Calendar Popup in a content page of a masterpage the strForName is always set to aspnetForm This breaks this line from working properly window.opener.document.forms...... How can...
1
by: sourcie | last post by:
I am changing an existing quiz found on "JavaScriptKit.com Multiple Choice Quiz" I have an image. Instead of using the radio buttons with the normal true/false question, I want to place two...
7
by: JDOMPer | last post by:
Don’t misunderstand me – I use AJAX, but I think there is a far simpler, elegant alternative that just uses Javascript, the DOM and Php ( hence - JDOMP) for data transfers, and is cross-browser...
5
by: thatcollegeguy | last post by:
Below are my 3php and 2js files. I create a table using ajax/php and then want to change the values in the tables add(+ number for teamid) id's for each specific td in the table. I don't know...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...

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.