473,839 Members | 1,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to reload page depending on the selection in the select tag in html

31 New Member
hi all,
I am using HTML, Javascript and CSS to code my pages.

I want to reload the same page upon selecting an option to get data from mysql tables depending on the option.

this is my sample code:
Expand|Select|Wrap|Line Numbers
  1. //javascript function
  2. function changeSelectAction(form)
  3.   {
  4.      //form.action = 'det.php';
  5.      document.forms['form-name'].action = 'det.php';
  6.   }
  7.  
  8. //html code
  9. <select name = "cli" onchange="return changeSelectAction(this.form);">
  10. <option value = "X">X </option>
  11. <option value = "Y">Y </option>
  12. <option value = "Z">Z </option>
the problem is that it is going into the function but no action is taken place.
the form data should go in POST method.
Where am I going wrong here???
Need suggestions or comments to solve this problem.

regards
Nelluru
Apr 14 '08 #1
2 2264
pronerd
392 Recognized Expert Contributor
the problem is that it is going into the function but no action is taken place.
Thats because you have not told it to do anything. Setting the action attribute does not submit the form, and there is no need to set it with JavaScript unless you are creating that value dynamically for some reason. Other wise what you want to set the action attribute with HTML and do is something like this.


Expand|Select|Wrap|Line Numbers
  1.     function changeSelectAction(form){
  2.         document.forms['form-name'].submit();
  3.     }
  4.  
Apr 14 '08 #2
Nelluru
31 New Member
Thats because you have not told it to do anything. Setting the action attribute does not submit the form, and there is no need to set it with JavaScript unless you are creating that value dynamically for some reason. Other wise what you want to set the action attribute with HTML and do is something like this.


Expand|Select|Wrap|Line Numbers
  1.     function changeSelectAction(form){
  2.         document.forms['form-name'].submit();
  3.     }
  4.  

thanks that worked well

regards
Nelluru
Apr 15 '08 #3

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

Similar topics

2
4034
by: Kingdom | last post by:
I have a SelectBoxes.asp page that is working with multiple selection dropdown boxes to extract data and total the selection prices. Tom & Bob were kind enough to give me a big help getting this page working and it's working just fine, no problems with this page. However I then would like this data e-mailed using jmail (my host insists on this method) and that is the function of the sendEMail2.asp page. This is failing and only giving...
8
2592
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and courses are populated. When course is selected, lists of occurrences, groups and
12
3131
by: joe | last post by:
I have a Javascript page which needs to be dynamically changed depending on user input. The whole page is written on document.write() output. I am still new to Javascript and run into problems with page reload. When user presses a button on my page most functions should clear the page and repaint it using my wholepage() function. After a couple of repaint the page goes into some error. Am I supposed to clear the div's in the page or wot?...
3
3185
by: dshan | last post by:
Hi all, I can't find an answer to my quesiton anywhere. Given a drop-down list with USA states and other text fields I pass this information for further processing via PHP. If any of the required fields is empty, the PHP script would return an error and reload the form page asking to fill out those fields. All entered information is saved... except for the drop-down list selection. I tried to write a Javascript function which is...
7
2411
by: GaryDean | last post by:
In my old 1.1 apps the default was MS_POSITIONING="GridLayout" and Textboxes and labels and such always had POSITION: absolute; and I never had any distortion when the page was rendered. Life was good. now in 2.0 I'm using the default placeholder and putting a table in the placeholder and putting controls in the cells in the table. "the way it is supposed to be done" I have a textbox in a table that is defined as follows... <td...
9
9924
by: ajos | last post by:
Hello friends, After thinking about this for sometime, i decided to post this in the java forum. Well my problem here in detail is, i have 3 jsp pages where in a.jsp(for example) i have a combo box, based on the selection of the value in that combo box, b.jsp page gets populated with the value associated to a.jsp, and again based on the selection of value of the 2nd combobox my 3rd combo box gets populated, which is in c.jsp. I'm able to...
1
2243
by: fsalvador | last post by:
Hi, I need help with this. I am trying to figure it out but I can't. I have 2 pages. I would like to display in the second page the content of one class and hide the content of the other classes. The idea is make the user to select a language, then display in the next page the content related to the selected option. This is the code I got so far, but I can't make it work. ###### PAGE 1 ######## <html>
0
10907
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
10586
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
10293
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...
0
9426
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...
1
7828
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
7017
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
5682
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...
1
4484
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
2
4064
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.