TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 04-25-2009, 08:09 PM   #21 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 646
Thanks: 64
allworknoplay is on a distinguished road
Default

Ok we're getting somewhere. Thanks for your hint on the SPAN tags. I was struggling on how to do that part...

So here's what we got.

1) you can create any number of rows by inputting a number.
a) Problem: it only adds rows, it should reset everytime a new number is inserted. I have this function, and I feel that we need to call it everytime to "reset" the created rows back to 0, I'm just not sure how to implement it.

Code:
function removeRows(tr) {
tr.parentNode.removeChild(tr);
}
I tried adding it to the "addRows()" function before it creates any rows. I was thinking there should be a FOR loop that will take the current number of created rows, loop through the "removeRows()" function and delete each row. But not surprisingly, it didn't work.



2) It now properly displays how many rows created.

3) It now properly displays how many checkboxes have been selected.
a) Problem: it only increments when you select a checkbox. If you deselect the checkbox, it actually increments, instead of decrement.


That's about it for now. One other question.

When I dynamically create the rows, how do I show the row count?

#
1
2
3
4
etc...

I created a SPAN ID called: row_count and tried to use the "i" increment value to update this like I normally would with PHP.

document.getElementById('row_count').innerHTML = i;

But doing so actually halted my script...
allworknoplay is offline  
Reply With Quote
Old 04-25-2009, 11:27 PM   #22 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 646
Thanks: 64
allworknoplay is on a distinguished road
Default

Ok, what am I doing wrong here? I want to count the checkbox and increment, if you uncheck, it should decrement.


My checkboxes are in a form named: form2
The checkboxes are named: checkbox

Code:
function checkbox_stat() {

if(document.form2.checkbox.checked == true)   ++document.getElementById('select_chks').innerHTML;	      

else --document.getElementById('select_chks').innerHTML;
	
}
I have a SPAN ID called: select_chks that displays the number of checkboxes selected.

And when you click on a checkbox, it calls the function above:

onClick="checkbox_stat(this);"


What I am getting is negative numbers like -1, -2, -3...

Which means that the first conditional isn't working and it's resorting to the else condition....which of course, decrements...

But why is this not working?

if(document.form2.checkbox.checked == true)
allworknoplay is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Planning your project Village Idiot Absolute Beginners 13 06-17-2009 02:46 PM
Freelance Suite: Client & Project Management Software CLCook Show Off 2 09-14-2008 10:50 AM
News - Phlox Project codefreek TalkPHP Developer Team 0 07-08-2008 08:22 PM
a decision has been made read for an update on the project codefreek TalkPHP Developer Team 9 07-02-2008 09:31 PM
Project Manager Nor Show Off 7 12-17-2007 07:51 PM


All times are GMT. The time now is 05:54 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design