As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
I have two checkboxes on my form, checkbox_A and checkbox_B. I want checkbox_A to act independantly, but if checkbox_B is checked I want checkbox_A to be checked too. Likewise if checkbox_B is unchecked, I want checkbox_A to become unchecked.
EDIT...sorry last sentance should read: Likewise if checkbox_A is unchecked, I want checkbox_B to become unchecked. Basically B cannot be on without A!
I am afraid I have no Javascript experience at all and have spent the last few hours trawling through forum posts and looking at the couple of existing Javascript routines we use here.
So far I have found how to call the Javascript, by using a 'onclick = control_cb(this)>' on my checkbox_B:
I then started with the following simple JS function which simply checked the other checkbox:
function control_cb(ctrl) { document.getElementById("checkbox_a").checked = true; }
I then tried to use similar logic to create an if statement but this is where things stop working:
i am assuming you have a html form. There is actually two different ways you can perform this check depending upon when you want to perform the check: You can do a validate with the submit button and/or perform an onclick="function name" shown below.
<INPUT TYPE="checkbox" NAME="b" VALUE="1" CHECKED onClick="clickFunction">
or you could do the following:
function() {
if(document.myform.boxb.checked == true)
{ document.myform.boxa.checked = true;}
else
{ document.myform.boxa.checked = false;}
}
WF 7.6.10 /IIS 6/ JBoss Enterprise 4.3 Windows XP SP 2/Windows 2003 Server MVS 7.3.3
That was a good attempt for someone that does not know JS. What was the passed 'checked' argument suppose to be? For future reference, you have a bit of redundancy in your code. It can be simplified as follows:
Many thanks for all your suggestions; it does look like I was pretty close which I am pleased about, just a case of swapping the double quotes for single quotes.
Francis thanks for providing a complete solution, it was very useful to me. I hadn't realised I could actually code the Javascript within the HTML! All our examples are held on the server (because they are used by multiple screens) whereas my requirement was specific to this screen only, so much better!
Dhagen, I wasn't sure about my 'checked' argument, every example I was looking at seemed to use something - I have now removed. Thanks also for you neat solution!
Cheers
Mark
WebFocus 765. iSeries v5r4
Posts: 175 | Location: England | Registered: April 11, 2006
Originally posted by PBrightwell: If the two check boxes are supposed to be the same, why not simplify both your screen and your program and use one check box?
The first checkbox allows the user a chance to search for certain conditions (orders that have not yet been shipped). The 2nd checkbox offers further functionality, but related to these conditions (of those orders not shipped what are awaiting stock). I didn't want the user to think they can use this 2nd function alone, as they must be used together. I could have coded this behind the scenes, but I wanted to make the screen clearer for the user - well that is the idea!
WebFocus 765. iSeries v5r4
Posts: 175 | Location: England | Registered: April 11, 2006