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

Dynamically change variables in FORM whithout reload page

Hi all!
How can i do this:

[HTML]<form method="get" action="test.asp" >
<input name="boys" type=radio value="John">John
<input name="boys" type=radio value="Lu">Lu
<input name="boys" type=radio value="James">James
<input name="student" type=checkbox value="yes">student?
[/HTML]
and now: if student=yes then this boy is a student:

[HTML] <input type=hidden name="message1" value="he is a student">
<input type=hidden name="message2" value="welcome">
[/HTML]
or if student not "yes" then boy is not a student:

[HTML] <input type=hidden name="message1" value="who is it">
<input type=hidden name="message2" value="bye">

<input type="submit" value="Ок">
</form>[/html]

Thanks
Sep 9 '06 #1
1 3590
acoder
16,027 Expert Mod 8TB
Add an onclick to the checkbox to call a function:
[HTML]<input name="student" type=checkbox value="yes" onclick="isStudent(this)">student?[/HTML]
Add an id to the hidden field for easy access:[HTML] <input id="message1" type=hidden name="message1" value="he is a student">[/HTML]
and now onto the javascript:
Expand|Select|Wrap|Line Numbers
  1. function isStudent(checkbox) {
  2.     var hidden = document.getElementById("message1");
  3.     if (checkbox.checked) {
  4.         hidden.value="this is a student";
  5.     } else {
  6.         hidden.value = "not a student";
  7.     }
  8. }
May 14 '08 #2

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

Similar topics

3
by: Dave Nouwens | last post by:
Hi All, Please accept my appologies in advance for what I expect will be a reasonably simple question. I have an html form (which is generated in php) which contains a number of rows (one row...
2
by: Ola Fjelddahl | last post by:
hi. I load a script dynamically and it works * everytime with IE6. * sometimes! with Mozilla1.5 <- makes me curious * never with Opera7.11 all tests on WindowsXP. With "sometimes" I mean
10
by: Randy Webb | last post by:
This page: http://www.hikksworld.com/loadJSFiles/ Is one where I was testing the ability of browsers that can/can't dynamically load a JS file with one of the three methods: 1)Changing the src...
3
by: Varad | last post by:
Hi all Pls give me some insight as to what I should be doing. I have a form where I have 20 text boxes and when an user submits the form I save it to a database. When they want to retrieve it, I...
1
by: Knud | last post by:
I have a frameset where a hidden frame reloads every 5 seconds and collects data from the sever if there are any changes made in a database. The hidden page updates Div fields on other frames with...
8
by: Donald Xie | last post by:
Hi, I noticed an interesting effect when working with controls that are dynamically loaded. For instance, on a web form with a PlaceHolder control named ImageHolder, I dynamically add an image...
2
by: Wee Bubba | last post by:
my page is split into 2 frames. my upper frame contains a data entry form consisting of asp.net textbox server controls. my lower frame displays rows of data. when a user clicks the submit...
10
by: EOZyo | last post by:
Hi, i'm trying to set pagination for a search i run on my website, i'll try to explain the easiest i can: When i click the search button on search.php, data is received and stored in variables...
1
Merlin1857
by: Merlin1857 | last post by:
How to search multiple fields using ASP A major issue for me when I first started writing in VB Script was constructing the ability to search a table using multiple field input from a form and...
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: 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: 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
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...
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...
0
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,...

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.