Hi David,

Thank you very much.  We got it to work but with a different approach.

I've done all the changes suggested by you and at the first glance it
looked like it worked fine but when I added one more (3rd) radio
button it always checked the 3rd one and when I added one more radio
button it always checked the 4th one.  So, it always checked the last
one, reason being the word 'checked' appears in the <input /> tag.  It
looks like whenever the attribute 'checked' appears, irrespective of
it's value the radio button will be checked and in our case since all
the radio buttons in the group have 'checked' attribute the last one
is getting selected.

So, keeping this in mind I've changed the radio buttons code to the
following to make it work.

<div ex:content="if(contains(.type, 'State'),'<input type=\'radio\'
name=\'radiogroup\' checked=\'checked\'>','<input type=\'radio\' name=
\'radiogroup\'>')"></div>State

<div ex:content="if(contains(.type, 'Country'),'<input type=\'radio\'
name=\'radiogroup\' checked=\'checked\'>','<input type=\'radio\' name=
\'radiogroup\'>')"></div>Country

<div ex:content="if(contains(.type, 'City'),'<input type=\'radio\'
name=\'radiogroup\' checked=\'checked\'>','<input type=\'radio\' name=
\'radiogroup\'>')"></div>City

Logic is the same but instead of using the function 'contains()'
inside the <input> used it in the ex:content of a div to populate the
whole <input> in a needed fashion with 'checked' attribute only for
the needed radio button.

Everything looks good with this approach till now.

Can we fine tune this approach or is it okay to use as it is?

Once again thank you very much David, for pointing at the right
direction especially the point you mentioned in your previous mail 'I
changed api-2.0 to api-2.1.0 so that it would work on IE8'.

Regards,
Ravi.


On Feb 25, 1:00 pm, David Huynh <[email protected]> wrote:
> Ravi,
>
> So, first, I changed api-2.0 to api-2.1.0 so that it would work on IE8.
> Then, I make sure that those data files are local (in the same directory
> as the HTML file); otherwise, they can't be accessed. Finally, I changed
> 'off' to just '' (an empty string). That seems to make it work on
> Firefox 3 and IE8 RC1. If I didn't change 'off' to '', then both options
> get selected, which is different from what you observed. Could you try
> the steps I did?
>
> David
>
> thotakura ravi.chandu wrote:
> > Hi David,
>
> > Hope this example helps me in letting you know my need.
> > Creating an HTML file with the following code should render Exhibit in
> > IE (for some reason it's not working in FF).
>
> > /<html>
> > <head>
> >     <title>CIA World Factbook - People</title>
>
> >     <link
> > href="http://simile.mit.edu/exhibit/examples/factbook/countries.js";
> > type="application/json" rel="exhibit/data" />
> >     <link
> > href="http://simile.mit.edu/exhibit/examples/factbook/people.js";
> > type="application/json" rel="exhibit/data" />
> >     <link
> > href="http://simile.mit.edu/exhibit/examples/factbook/government.js";
> > type="application/json" rel="exhibit/data" />
>
> >     <script
> > src="http://static.simile.mit.edu/exhibit/api-2.0/exhibit-api.js";
> > type="text/javascript"></script>
> >     <script
> > src="http://static.simile.mit.edu/exhibit/extensions-2.0/chart/chart-exten...";
> > type="text/javascript"></script>
>
> >     <style>
> >         body {
> >             font-family:    Tahoma, Arial, sans serif;
> >             font-size:      10pt;
> >             margin:         0;
> >             padding:        0;
> >         }
> >         table {
> >             font-size:      100%;
> >         }
> >         tr {
> >             vertical-align: top;
> >         }
> >         #title-area {
> >             padding:        1em 2em;
> >             background:     #BCB79E;
> >         }
> >     </style>
> > </head>
> > <body>
> >     <div id="title-area">
> >         <h1>CIA World Factbook - People</h1>
> >     </div>
> >     <div id="content-area"><div style="width: 100%;">
> >         <table width="100%" cellspacing="20">
> >             <tr>
>
> >                 <td width="20%">
> >                     <div ex:role="facet"
> >                         ex:expression=".speaks"
> >                         ex:facetLabel="Languages"
> >                         ex:height="40em"></div>
> >                 </td>
> >                 <td>
> >                     <div ex:role="viewPanel">
> >                         <div ex:role="view"
> >                            ex:viewClass="Exhibit.ScatterPlotView"
> >                            ex:label="Birthrate vs. Deathrate"
> >                            ex:x=".birthrate"
> >                            ex:xLabel="Birthrate"
> >                            ex:y=".deathrate"
> >                            ex:yLabel="Deathrate">
> >                         </div>
> >                         <div ex:role="view"
> >                            ex:viewClass="Exhibit.BarChartView"
> >                            ex:label="Populations"
> >                            ex:x=".population"
> >                            ex:xLabel="Population"
> >                            ex:y="value"
> >                            ex:yLabel="Country Name"
> >                            ex:xAxisType="log">
> >                         </div>
>
> >                     </div>
> >                 </td>
> >                 <td width="20%">
> >                     <div ex:role="facet"
> >                         ex:expression=".member-of"
> >                         ex:facetLabel="Members Of"
> >                         ex:height="10em"></div>
> >                     <div ex:role="facet"
> > ex:facetClass="Exhibit.NumericRangeFacet"
> >                         ex:expression=".population"
> >                         ex:interval="10000000"
> >                         ex:facetLabel="Population"
> >                         ex:height="20em"></div>
> >                 </td>
> >             </tr>
>
> > <tr><td>
> >     <table width="580px" ex:role="lens" cellspacing="0" cellpadding="0">
> >        <tr>
> >            <td >
> >           <b>Country Name:&nbsp;</b><a accesskey="U"
> > ex:href-content=".uri" target="_blank"><span ex:content=".label"
> > ></span></a></td>
>
> >         </tr>
> >        <tr>
> >            <td >
>
> >             <b>Type:&nbsp;
>
> > <!-- The following do not select the lastradiobutton by default -->
> >  <!-- <input type=radioname="test">
> >  <input type=radioname="test">
> >  <input type=radioname="test">
> >  <input type=radiochecked name="test">  -->
>
> >  <!-- The following throws an error
> > Unexpected text = at position 10 -->
> > <!-- <input type="radio" ex:name-subcontent="radiogroup-{{value}}"
> > ex:checked-content="if(.type == 'Country', 'on', 'off')">Country
> > <input type="radio" ex:name-subcontent="radiogroup-{{value}}"
> > ex:checked-content="if(.type == 'State', 'on', 'off')">State     -->    
>
> > // <!-- This too did not work -->
> > <!-- <input type="radio" ex:name-subcontent="radiogroup-{{value}}"
> > ex:checked-content="if(.type = 'Country', 'on', 'off')">Country
> > <input type="radio" ex:name-subcontent="radiogroup-{{value}}"
> > ex:checked-content="if(.type = 'State', 'on', 'off')">State     --> /
> > /
> > <input type="radio" ex:name-subcontent="radiogroup-{{.id}}"
> > ex:checked-content="if(contains(.type, 'State'), 'on', 'off')">State
> > <input type="radio" ex:name-subcontent="radiogroup-{{.id}}"
> > ex:checked-content="if(contains(.type, 'Country'), 'on', 'off')">Country
>
> >  </tr>
> >         </table>
> > </td></tr>
>
> >         </table>
> >     </div></div>
>
> > </body>
> > </html>/
>
> > I am trying to make the secondradiobutton checked by default, using
> > the value from 'type'.  The value for 'type' is always 'Country'. But
> > the secondradiobutton never gets selected.
>
> > Thanks in advance,
> > Ravi.
>
> > On Thu, Feb 19, 2009 at 12:56 AM, David Huynh <[email protected]
> > <mailto:[email protected]>> wrote:
>
> >     Ravi,
>
> >     It is best if you can make a barebone exhibit with a bit of fake data
> >     that illustrates this problem and send us the files here. It's much
> >     easier for me or someone else to try to debug them ourselves.
>
> >     David
>
> >     chandu wrote:
> >     > Hi David,
> >     > Thanks very much for the reply.
>
> >     > if(.yourated == 'Good', 'on', 'off')  - did not work.
> >     > Tried if(.yourated == 'Good', 'true', 'false') - This too did not
> >     > work.
>
> >     > Any other thoughts please...
> >     > Thanks,
> >     > Ravi.
>
> >     > On Feb 11, 6:58 am, David Huynh <[email protected]
> >     <mailto:[email protected]>> wrote:
>
> >     >> chandu wrote:
>
> >     >>> Hi David,
>
> >     >>> Thanks for the example.
>
> >     >>> In
> >     >>> if(.yourated == 'Good', 'on', 'off')
> >     >>> the double equals to gave a JS error while opening the lens. So
> >     >>> changed it single equals to (though I know that it wont be
> >     correct).
> >     >>> The approach did not work. I mean all theradiobuttons were getting
> >     >>> presented but none is getting checked.
>
> >     >> Hi Ravi,
>
> >     >> Would you mind giving it another shot, with this expression
> >     instead?
> >     >>     if(contains(.yourated, 'Good'), 'on', 'off')
>
> >     >> David
>
> > --
> > A day is a wonderful blessing,
> > Either stormy or sunny,
> > It stands for hope,
> > Giving us another chance of what we call *L*I*F*E*.
> > Live a beautiful LIFE.
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SIMILE Widgets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/simile-widgets?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to