Refresh form with value selected from combo / drop down box

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
vikaspa
Forum Newbie
Posts: 8
Joined: Tue Aug 31, 2004 12:30 am
Location: Mumbai,India

Refresh form with value selected from combo / drop down box

Post by vikaspa »

I have a form for say weather

I want user to select a month from combo or drop down box having months (January to December) and want to refresh the information with certain details like temperature during day and night and season (rainy, autum, winteretc) already stored in database ...

Please help !!

At present I can submit the form using following javascript

document.form.submit();

However help me how do i refresh form with current value (of month chosen) by the user.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

use the onchange event available in the select tag, however, you should provide the user an ability to manually submit the change (in case they have scripting turned off)
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

Vikas Bhai, as feyd has told ya use onchange event to accept the change from combo box. then u should update the result by using something like document.form.temperature.Value = 98 etc.

Bye 4 Now! :P
seth1334
Forum Newbie
Posts: 1
Joined: Mon Dec 27, 2004 5:06 am

Post by seth1334 »

If you want to do a database lookup without reloading the page, you can use a popup window which calls aphp script to do the lookup, and a bit of javascript to set opener.document.forms[whatever].elements[whatever] to the desired value.
HTH
Post Reply