Martin Yergeau Posted June 22, 2021 Share Posted June 22, 2021 Michele, use the tag code to post your code sample otherwise, such as in this case, it has been truncated due to html characters or you can type (without spaces) [ code] your code here [ /code] But should be something like this function mrs_ddbox_subtotals_onclick(event) { var selOpt = IbComposer_getCurrentSelection('mrs_ddbox_subtotals'); if (selOpt == 'Y') alert ("Selection is true"); } Or like that depending of type of control function mrs_ddbox_subtotals_onclick(event) { if (mrs_ddbox_subtotals0.checked == true) alert ("Selection is true"); } And may also have other ways to do it Link to comment Share on other sites More sharing options...
Michele Brooks 2 Posted June 22, 2021 Author Share Posted June 22, 2021 MartinY, I used your first suggestion because I want an alert message to pop up when the user clicks the radio button that has Y as the value. I ran the code below but when I clicked on the radio button no message popped up. Please let me know what I am doing wrong. Thanks. [/ Version:1.0 StartHTML:000000174 EndHTML:000001006 StartFragment:000000550 EndFragment:000000974 StartSelection:000000550 EndSelection:000000974 SourceURL:about:blank body {white-space:nowrap;margin-left:0;margin-right:0;} select {font:10pt courier new;} div {padding-bottom: 1px; padding-top: 1px} //Begin function mrs_ddbox_subtotals_onclick function mrs_ddbox_subtotals_onclick(event) { { var selOpt = IbComposer_getCurrentSelection(mrs_ddbox_subtotals); if (selOpt == Y) alert (The subtotal field must be the first selected report field!); } //End function mrs_ddbox_subtotals_onclick ] Link to comment Share on other sites More sharing options...
Martin Yergeau Posted June 22, 2021 Share Posted June 22, 2021 Try the following to test the control value function mrs_ddbox_subtotals_onclick(event) { var selOpt = IbComposer_getCurrentSelection(mrs_ddbox_subtotals); alert ("selOpt"); //if (selOpt == Y) //alert (The subtotal field must be the first selected report field!); } But since its a radio, the second option should work better. Let pretend that you have three options. So referring options should be like that: First option (A) is named mrs_ddbox_subtotals0 Second option (Y) is named mrs_ddbox_subtotals1 Third option (N) is named mrs_ddbox_subtotals2 Then if second option is the one with the Y value, you can normally do the following function mrs_ddbox_subtotals_onclick(event) { if (mrs_ddbox_subtotals0.checked == true) alert ("Option 1 is selected"); else if (mrs_ddbox_subtotals1.checked == true) alert ("Option 2 is selected"); else alert ("Option 3 is selected"); } Link to comment Share on other sites More sharing options...
Michele Brooks 2 Posted June 22, 2021 Author Share Posted June 22, 2021 MartinY: function mrs_ddbox_subtotals_onclick(event) { { var selOpt = IbComposer_getCurrentSelection(mrs_ddbox_subtotals); alert (selOpt); I tested the control value but nothing happens when I click the subtotals button. Should I delete it and create it again It is a static button control that passes either a Y (this means to include subtotals in the report, and N (this means do not include subtotals in the report). Link to comment Share on other sites More sharing options...
Martin Yergeau Posted June 22, 2021 Share Posted June 22, 2021 Are you sure that the function is associated with the control as an event For me it seems that the event is never triggered Link to comment Share on other sites More sharing options...
Michele Brooks 2 Posted June 22, 2021 Author Share Posted June 22, 2021 Yes. I highlighted the radio button box called mrs_ddbox_subtotals. I opened the properties menu, then clicked on the lightening bolt tab and clicked on the ellipse buttons for the click event and added the JavaScript code. Link to comment Share on other sites More sharing options...
Martin Yergeau Posted June 22, 2021 Share Posted June 22, 2021 Try with the following function mrs_ddbox_subtotals_onclick(event) { alert ("In OnClick event"); } If the event is properly called, you should see that alert Link to comment Share on other sites More sharing options...
Michele Brooks 2 Posted June 22, 2021 Author Share Posted June 22, 2021 MartinY: function mrs_ddbox_subtotals_onclick(event) { { alert (In OnClick event); } Nothing happened. I can delete it and create a new event. Link to comment Share on other sites More sharing options...
Michele Brooks 2 Posted June 22, 2021 Author Share Posted June 22, 2021 One other point. The control by itself actually works because I tested it. When I click the selection N and run the report, no subtotals appear on the report. When I click the selction Y and run the report, subtotals appear on the report. So to values are being passed to the control. Link to comment Share on other sites More sharing options...
Martin Yergeau Posted June 22, 2021 Share Posted June 22, 2021 Select the radio button box called mrs_ddbox_subtotals. Then opened the properties menu, clicked on the lightening bolt tab and clicked on the ellipse buttons for the Value Changed event and added the JavaScript code. Link to comment Share on other sites More sharing options...
David Beagan Posted June 22, 2021 Share Posted June 22, 2021 Are the curly braces balanced in the code you are actually creating Link to comment Share on other sites More sharing options...
Michele Brooks 2 Posted June 22, 2021 Author Share Posted June 22, 2021 Ill send my code in a minute. I retesting. Thanks, Link to comment Share on other sites More sharing options...
Michele Brooks 2 Posted June 22, 2021 Author Share Posted June 22, 2021 michele.brooks: { var selOpt = IbComposer_getCurrentSelection(mrs_ddbox_subtotals); if (selOpt == Y) alert (The subtotal field must be the first selected report field!); } MartinY, your code actually worked. Yay. Thank you so much. I decided to add your code to my backup version of the html page and it worked. I first used your code to test the button and then I used the onclick code. I think I did too much on the JavaScript tab in the version that I was working on and it stopped working. Im glad I backed it up before I started making changes to it. Thanks again. Link to comment Share on other sites More sharing options...
Michele Brooks 2 Posted June 22, 2021 Author Share Posted June 22, 2021 [sOLVED] 2021-06-22T04:00:00Z David, thanks for viewing my post. I had to use my backup version of the html page because the one I was working on stopped working properly. I used MartinYs suggestion and it worked. Are the curly braces balanced in the code you are actually creating Link to comment Share on other sites More sharing options...
Michele Brooks 2 Posted June 22, 2021 Author Share Posted June 22, 2021 I need to create an alert message when a value of Y is selected for mrs_ddbox_subtotals radio button. I created the following event. [/ //Begin function mrs_ddbox_subtotals_onclick function mrs_ddbox_subtotals_onclick(event) { ] MBrooks, Webfocus App Studio 8207 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now