KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

how to Allow To Check Only One Checkbox

 
Post new topic   Reply to topic    KiXforms Forum Index -> Starters Code Clinic
View previous topic :: View next topic  
Author Message
largo
KiXforms Novice
KiXforms Novice


Joined: 09 Dec 2008
Posts: 3

PostPosted: Thu May 21, 2009 11:55 am    Post subject: how to Allow To Check Only One Checkbox Reply with quote

is it possible ?

can someone show me an exmaple code , or explain how to do it ?

thanks
Back to top
View user's profile Send private message
eriqjaffe
KiXforms Follower
KiXforms Follower


Joined: 16 Aug 2004
Posts: 19
Location: Arlington Heights, IL, USA

PostPosted: Thu May 21, 2009 3:13 pm    Post subject: Re: how to Allow To Check Only One Checkbox Reply with quote

largo wrote:
is it possible ?

can someone show me an exmaple code , or explain how to do it ?

thanks
You'd be better off using radio buttons, they only allow one to be selected.
Back to top
View user's profile Send private message
Gargoyle
KiXforms Aficionado
KiXforms Aficionado


Joined: 30 Dec 2003
Posts: 366
Location: Arizona

PostPosted: Thu May 21, 2009 7:32 pm    Post subject: Reply with quote

And if radio buttons are not option (can't think of any reason why not but..)

Create a control array of your checkboxes

Use the .onclick= method to call a function that unchecks all of the checkboxes except the one clicked on.

example
Code:

$checkbox_array[3].onclick = "reset_checks(3) ; you have to pass the value of the current checkbox

Function reset_checks($Current)

For $ = 0 to ubound $checkbox_array
  If $ <> $current
    $checkbox_array[$].checked = "False"
  EndIf
Next

_________________
Parents were invented to make children happy by giving them something to ignore.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Starters Code Clinic All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group