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

memorize form settings

when is load a page I have a form with some elements that are
text, textfield, select, select multiple, checks, radios.
where text and textfield are filled with some words,
select have how first elements a specific option,
checkboxses (some are checked) ..
how I can memorize all this initilly settings and recall
with a button if is necessary reinsert all?
I found this but on some select not work (I will make an example)
javascript:document.getElementById("id-form").reset();

in select elements where not work I make a test and also if they are inner
form, only if I write directly code can change the selectedIndex;

I will send a code for test
Jun 27 '08 #1
3 1058
VK
On Apr 27, 6:17 pm, artev <mailnotspa...@notspamm.nnwrote:
when is load a page I have a form with some elements that are
text, textfield, select, select multiple, checks, radios.
where text and textfield are filled with some words,
select have how first elements a specific option,
checkboxses (some are checked) ..

how I can memorize all this initilly settings and recall
with a button if is necessary reinsert all?

I found this but on some select not work (I will make an example)
javascript:document.getElementById("id-form").reset();

in select elements where not work I make a test and also if they are inner
form, only if I write directly code can change the selectedIndex;

I will send a code for test
There should be no problem to use reset() method as long as you don't
have a form element named "reset": in such case you'll a naming
conflict. Possibly this is what you have now, like:
<input type="reset" name="reset" value="reset">
Make sure that your reset button (if presented) is not named "reset".
Otherwise reset() exists exactly for what you are trying to do and it
should work for all browsers up to the most ancient ones, especially
if you use DOM 0 instead:

<form name="MyForm" ...

and then later:

document.forms['MyForm'].reset();

Jun 27 '08 #2
<form name="MyForm" ...
>
and then later:

document.forms['MyForm'].reset();
can found form only by id; but isn't this problem;
problems seem to be that the elemnts are used for make a search;
so first of search if change value the reset() work; after not more;
I think change something in the url;

so would think other solutions:
I think must 'simple' make a cicle of all elements and achieve set inner
variables; so with buttons can reload all the set
Jun 27 '08 #3
VK wrote on 27 apr 2008 in comp.lang.javascript:
On Apr 27, 6:17 pm, artev <mailnotspa...@notspamm.nnwrote:
>when is load a page I have a form with some elements that are
text, textfield, select, select multiple, checks, radios.
where text and textfield are filled with some words,
select have how first elements a specific option,
checkboxses (some are checked) ..

how I can memorize all this initilly settings and recall
with a button if is necessary reinsert all?

I found this but on some select not work (I will make an example)
javascript:document.getElementById("id-form").reset();

in select elements where not work I make a test and also if they are
inner form, only if I write directly code can change the
selectedIndex;

I will send a code for test

There should be no problem to use reset() method as long as you don't
have a form element named "reset": in such case you'll a naming
conflict. Possibly this is what you have now, like:
<input type="reset" name="reset" value="reset">
Make sure that your reset button (if presented) is not named "reset".
Otherwise reset() exists exactly for what you are trying to do and it
should work for all browsers up to the most ancient ones, especially
if you use DOM 0 instead:

<form name="MyForm" ...

and then later:

.reset();
IE [not tested here], perhaps cross browser too, will do:

function resetTextInput(el){
var temp = document.forms['MyForm'].elements[el];
temp.value = temp.defaultValue;
};

resetTextInput('myTextInput');

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 27 '08 #4

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

Similar topics

2
by: Bill Struve | last post by:
Need: Auto-logon to a terminal server, start a program, and, when the user is quits the program, auto-logoff. Problem: When msrdp.ocx is added to the Toolbox, attempting to draw the control on...
6
by: jean.ulrich | last post by:
Hi I have a form that is not related with a table neither a query (unbound form) On this form I have a text field where the user can put a text or a number As I dont want to create a table...
2
by: Bill Stillwell | last post by:
I am trying to set the "backcolor" property in fields in a form. It sets okay using a macro (setvalue). But when I close the form, the property settings revert back to what they were before I...
1
by: Bill Stillwell | last post by:
I am trying to set the "backcolor" property in fields in a form. It sets okay using a macro (setvalue). But when I close the form, the property settings revert back to what they were before I...
3
by: Tsahi Asher | last post by:
hi, i was trying to save the window size of my app using the generated Settings class of Visual C# 2005 Express. for some reason, the stored size was bigger from the actual size, so each time i...
3
by: pantagruel | last post by:
Hi, the following: FileSystemWatcher watcher = new FileSystemWatcher(); RenderingQ = ConfigurationSettings.AppSettings; //RenderingQ = "C:\\RenditionServerQ\\InjectorQ\\OnDemandQ";...
3
by: jambonjamasb | last post by:
Hi I have two tables: email_tbl Data_table Data table is is used to create a Form Data_form
1
by: artev | last post by:
when is load a page I have a form with some elements that are text, textfield, select, select multiple, checks, radios. where text and textfield are filled with some words, select have how first...
7
by: PetterL | last post by:
I have a setting called My.settings.firstrun set to True, set in the setting manager. When i read this in the first form form_Load in a IF sentence it always come out as false. I have tried to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
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,...

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.