Radio buttons instead of a list box in the embedded DS?

Rod Widdowson rdw at steadingsoftware.com
Tue Jun 21 11:33:50 EDT 2016


> Rod, you said it's pretty simple, as I expected, to change the "select
from a list"
> to radio buttons. If we do that, we'd also want to get rid of the link to
take users
> back to the type-ahead text box selection method.

Well I'm not sure that for 3 IdPs I wouldn't just do Peter's suggestion of
just growing some static HTML. 

But what you need to do is 

0) Get the EDS working.
1) Set the config file to be "this.showListFirst = true;"
2) In Idpselect.js (non minimized of course), Modify
buildIdPDropDownListTile to
 - Not build a select statement
 - In the loop do not call buildSelectOption, but rather grow an appropriate
radio button 

     var but = document.createElement('input');
     but.setAttribute('type', 'radio');
     but.value=getEntityId(idp);
     but.name=returnIDParam;

     var div = document.createElement('div');
     div.appendChild(but);
     var text = getLocalizedName(idp);
     if (text.length > maxIdPCharsDropDown) {
          text = text.substring(0, maxIdPCharsDropDown);
     }
     div.appendChild(document.createTextNode(text));

   - Insert the containing div directly into the form

   - make the button's onclick function set a value in the outer form 

	but.onclick = function() {
             	   form.selectedValue = this.value;
            	}

 - Initialize form.selectedValue to -1
 - change the form.onsubmit function to be
        form.onsubmit = function () {
            if (this.selectedValue < 1) {
                return false;
            }
            selectIdP(this.selectedValue);
            return true;
        };
  - supress the "Switcher <a>, and call buildHelpText with form as the
parameter.
3) You may then need to go in and modify the CSS - particularly for the help
text.

So not "pretty simple" as I said, but not mind boggling.

YMMV of course....

HTH

/R



More information about the dev mailing list