Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 31st, 2006, 10:02 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default Clear multi select area selections

I have a page where there is a button to clear selected values. Some are type = text, some select areas, some checkboxes and one multi select area.

Her is my function (fired onClick of a reset values button):

function resetValues()
{
    document.osirSearch.signalSearch.value='';
    document.osirSearch.hriMin.value='0';
    document.osirSearch.hriMax.value='20';
    clear_checkBoxes();
}

function clear_checkBoxes()
{
     for (var i = 0; i < document.osirSearch.cIDs.length; i++)
     {
        document.osirSearch.cIDs[i].checked = false;
     }
}

This resets any selections made back to the default page loading values. How can I reset a multiselect list in addition to the ones being reset. I wish for this to happen onClick of one button and do not wish to instruct the user to Ctrl + click (which would achieve my objective)

NOTE: If I place (cIds is the name of the multiselect box):
document.osirSearch.cIDs.value='';
inside the function the selections are cleared however when the page is refreshed they appear selected again (unlike all the others)

TYIA

Wind is your friend
Matt
__________________
Wind is your friend
Matt
 
Old November 7th, 2006, 01:01 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii Matt!!

When page is refreshed ,browser loads the page from cache or server (if there is any content expiry policy), so whenever ur onClick button is clicked ,ur multiselect list is cleared ,ok no probs,but when you refresh the page ,since there is no posting of the data to the server, it only retrieves back your current page from cache(or fresh page from the server), you are getting the multiselect list with values.

you can use javascript cookies to solve this problem, again it also depends on client browser settings.
Hope this will help you

Cheers :)

vinod





Similar Threads
Thread Thread Starter Forum Replies Last Post
Multi-use of UDF in SELECT statement monnyann SQL Server 2005 7 October 3rd, 2007 06:01 AM
Multi-Select Parameters jparkgb BOOK: Professional SQL Server 2005 Reporting Services ISBN: 0-7645-8497-9 0 August 14th, 2006 06:02 AM
Multi-Select List Boxes and Calculations flrzeus BOOK: Expert One-on-One Access Application Development 0 December 5th, 2005 10:43 AM
Select Menu Multiple Selections phungleon HTML Code Clinic 2 July 20th, 2004 12:25 PM
Multi Select Combo Box acdsky VB How-To 2 March 1st, 2004 03:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.