CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Javascript set SELECTED

Print topic Send  topic

Author Message
tsturgeon

Posts: 7
Posted: 05/17/2006, 10:50 AM

I want to add a button to a Record form that contains a multi-select ListBox.

When the button is pressed, I want to select all the items in the list, or deselect all.

Right now, when I add a button, it activates the submit button even if I give it the Cancel function.

How do I get the button to fire the proper event without submitting the form?

Also, how do I set the items as SELECTED using selected?
View profile  Send private message
Benjamin Krajmalnik
Posted: 05/17/2006, 12:26 PM

Use a regulat HTML button (not a CodeCharge button). Capture the onClick()
event to call a Javascript function which will select the items.
I have something similar, except I am using a checkbox as the toggler, and a
checkbox list instead.

The function looks like this:

function select_deselectAll (chkVal, idVal)
{
var frm = document.forms.tblRepsSearch;
var elementcount;
elementcount = frm.length;
// Loop through all elements

for (i=0; i<elementcount; i++)
{
if (frm.elements.type=='checkbox')
{
// Check if main checkbox is checked
if(chkVal == true)
{
frm.elements.checked = true;
}
else
{
frm.elements.checked = false;
}
}
}
}

and is called by a control in a form called tblRepsSearch as follows:


<span style="FLOAT: left; "><input type="checkbox" name="{CheckAll_Name}"
value="1" onclick="javascript: return select_deselectAll (this.checked,
this.id);" {CheckAll}> All</span>

Hope this helps you out.


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.