CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Get the value of checkbox

Print topic Send  topic

Author Message
gnlehcar

Posts: 15
Posted: 08/01/2008, 3:05 AM

Hi all~~
Do anyone know how to get the value of checkbox in client side??
It is because I have something similar to the order entry in the example pack..
however, I have to keep track of the total, which must always be zero..
My thought is to check whether the checkbox(delete) is checked..if yes, then deduct the value from the total..so that I can do the validation in client side...

I have modified the codes in Show_Total():
function Show_Total()  
{  
 var TotalSum=0;  
 var Summ;  
    for(var i = 0; i < store_orders_itemsElements.length; i++){  
	  Summ = StrToFloat(store_orders_itemsElements[ i ][store_orders_itemspriceID].value) *  
            StrToFloat(store_orders_itemsElements[ i ][store_orders_itemsquantityID].value);  
      TotalSum = TotalSum + Summ;  
      if (Summ == 0) {  
        store_orders_itemsElements[ i ][store_orders_itemsSumPriceID].value = "";  
	  } else {  
        store_orders_itemsElements[ i ][store_orders_itemsSumPriceID].value = Math.round(Summ*100)/100;  
	  }  
      if (store_orders_itemsElements[ i ][store_orders_itemsDelete1ID].value == true)  
	TotalSum = TotalSum - Summ;   
    }  
    document.store_orders_items.Total_price.value = Math.round(TotalSum*100)/100;  
}

However, it gives me the following error:
'store_orders_itemsElements[ i ][store_orders_itemsDelete1ID]' is undefined

Could somebody give me a hand??
Sorry for so many questions these few days...><"

Best wishes,
Rachel
_________________
Rachelbo
View profile  Send private message
jjrjr1


Posts: 942
Posted: 08/01/2008, 6:51 AM

Hi

Is your store_orders_itemElements actually a 2 dimentional array? If it is and has been initialized with data I would try.

OrderElements = new Array();
var e=document.getElementById("store_orders_itemElements");

OrderElements=e.value;

Then user OrderElements [xxx] [xxx] as your array.

Be sure "store__orders_itemElements" is the actual id for the data field in the html.

If it has not been initialized as an array then you will need to be sure your PHP sends it that way or determine how to convert it to an array in the html.

Does That Help. I am just guessing right now.

_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com
View profile  Send private message
karen

Posts: 99
Posted: 02/25/2009, 7:22 PM

Hi,

I just stumble upon this post looking for a solution to my own problem. First my problem is, how to detect the delete control checkbox for a new row? The 'invisible' checkbox appears to return a checked value for a new row!

And here's the solution (hopefully) to your problem. Refer to the delete checkbox as:
store_orders_itemsElements[ i ][store_orders_itemsDeleteControl].checked

Hopefully, this is not too late for you :)

Cheers,
Karen
View profile  Send private message

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.