Focal Point
[Solved] limiting the customselect1_selectto to a number

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/219100122

August 26, 2009, 11:15 AM
ERINP
[Solved] limiting the customselect1_selectto to a number
I am currently using 7.6.9.
I am trying to use a Double List Control.
The customselect1_selectfrom has multiple values. I want to be able to limit the number of selectable items in the customselect1_selectfrom's to 5. So as the user highlights an item and adds(+) it to the customselect1_selectto list they can only have 5 items in the customselect1_selectto. Is this possible?

Thanks,
Erin

This message has been edited. Last edited by: ERINP,


WebFOCUS 7.6.9

Reporting client Windows 2003 Service pack 2 using IIS and TomCat 5.5
Reporting Server OS/400 V5R4M0
Outputs: HTML, Excel, PDF, CSV, and Flat Files
September 04, 2009, 09:04 PM
jnc
Hello Erin....

You can count the number of entries by using JavaScript. A block of JavaScript code like this should do that.

function validate()
{
var maxCount = 5;
var limit = document.getElementById("customselect1_selectto").length;
if(limit > maxCount)
{
alert("Maximum number of selections is "+maxCount+", please retry");
return false;
}
return true;
}

To fire the JavaScript, you can put a onclick event on the submit button,

onclick="return validate()"


WebFocus 7x, 8x, Win / Linux, any output format
September 08, 2009, 08:09 AM
ERINP
JNC thanks for the reply. I will give it a try.


WebFOCUS 7.6.9

Reporting client Windows 2003 Service pack 2 using IIS and TomCat 5.5
Reporting Server OS/400 V5R4M0
Outputs: HTML, Excel, PDF, CSV, and Flat Files
September 03, 2013, 04:48 PM
Ryan N
Thread Resurrection!! I want to do the exact same thing as the OP. However, when I put the code in the OnClick button to run the report, the message pops up but the report still runs. Is there a way to cancel the report running?

Ideally, I would like to inform the user sooner that they have selected too many, and not even let them select too many to begin with, by giving the message when the first option over the limit is added to the right list box. I was looking at using the onclick of the double list box Add button, but the user can double click options in the left list box to add to the right, so that would not consistently capture the scenario.

Any other ideas?

Thanks-
Ryan N


WF: WebFocus 8.0.02
InfoAssist, Dev Studio, Magnify, Portal/Dashboards, Mobile Favs
Data: DB2
OS: Windows
Output: Multiple