Jump to content
The ibi Community has moved to a new platform: Please Sign In and choose Forgot Password to continue

I need to create an alert message when a value of Y is sel...


Michele Brooks 2

Recommended Posts

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

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

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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...