
| Key: |
WTR-174
|
| Type: |
Bug
|
| Status: |
Open
|
| Priority: |
Minor
|
| Assignee: |
Unassigned
|
| Reporter: |
Lisa Crispin
|
| Votes: |
0
|
| Watchers: |
0
|
|
If you were logged in you would be able to see more operations.
|
|
|
Watir
Created: 06/Sep/07 11:40 AM
Updated: 24/Nov/08 02:04 PM
|
|
| Component/s: |
None
|
| Affects Version/s: |
1.5.0/1.5.1
|
| Fix Version/s: |
Soon
|
|
|
Original Estimate:
|
Unknown
|
Remaining Estimate:
|
Unknown
|
Time Spent:
|
Unknown
|
|
Environment:
|
Windows XP client, IE 6
|
|
|
Writing script for a page where selecting certain items will cause other radio buttons further down the page to enable so you can select those too. This worked manually, but when the Watir script selected the item, the other radio buttons were not enabled. I worked around by coming back to the page, but that was clumsy.
I did get an answer for how to do this from Zeljko and it worked, but Bret said this should be entered as a bug.
This was the solution:
ie.select_list(:id, "planAdvisorId").select("Lastname, Firstname")
ie.select_list(:id, "planAdvisorId").fire_event("onclick")
This was the javascript:
<form method="post" action="">
<p>
Enter the plan's <b>Tax ID</b> (EIN), an optional <b>Promo Code</b> and select a <b>Product Fee Schedule</b>.
</p>
<table width="100%">
<colgroup>
<col id="labels"/>
<col id="fields"/>
</colgroup>
<tbody>
<tr>
<td><label>Tax ID:</label></td>
<td>
<input type="text" id="taxId" name="taxId" value="" size="12" maxlength="10"> <br/>
</td>
</tr>
<tr>
<td><label>Promo Code:</label></td>
<td>
<input type="text" id="promoCode" name="promoCode" value="" size="12" maxlength="3"> <br/>
</td>
</tr>
<tr>
<td valign="top"><label>Product Fee Schedule:</label></td>
<td style="background-color:#eee;">
<input type="radio" id="productFeeScheduleId" name="productFeeScheduleId" value="15"
checked="checked"
> Unknown <br/>
<input type="radio" id="productFeeScheduleId" name="productFeeScheduleId" value="2"
> pretend unbundled <br/>
</td>
</tr>
</tbody>
</table>
<p>
When establishing the plan on behalf of an advisor, you must also select the <b>Plan Advisor</b>,
the advisor's <b>Service Level</b> and associated <b>Rate</b>(s).
</p>
<table width="100%">
<colgroup>
<col id="labels"/>
<col id="fields"/>
</colgroup>
<tbody>
<tr>
<td><label>Plan Advisor:</label></td>
<td> <select id="planAdvisorId" name="planAdvisorId" onclick="javascript:selectPlanAdvisor();">
<option value="0"
selected="selected"
>
No Advisor</option>
<option value="138886"
>
Lastname, Firstname</option>
</select>
</td>
</tr>
<tr>
<td valign="top"><label>Service Level:</label></td>
<td style="background-color:#eee;">
<input type="radio" id="serviceLevelId" name="serviceLevelId" value="2010"
checked="checked" onclick="javascript:selectServiceLevel();"> <label>Basic Service</label>
<div style="padding:1em 1em 1em 5em;">
<label>Services Provided:</label><br/>
<ul>
<li>Online Plan Establishment</li>
<li>Review of Investment Options</li>
<li>Annual Plan Review</li>
</ul>
<table width="80%" class="withHeader" style="border:1px solid black;">
<colgroup>
<col width="10%" align="center"/>
<col width="45%" align="right"/>
<col width="45%" align="right"/>
</colgroup>
<thead>
<tr class="header">
<th align="center">Tier</th>
<th align="right">Asset Ceiling</th>
<th align="right">Rate</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center"><b>1.</b></td>
<td align="right">$999,999,999,999.00</td>
<td align="right"> <select id="serviceLevels[0].serviceLevelTiers[0].selectedRate" name="serviceLevels[0].serviceLevelTiers[0].selectedRate" >
<option value="0.50%"
selected="selected"
>
0.50%</option>
</select>
</td>
</tr>
</tbody>
</table>
</div>
<input type="radio" id="serviceLevelId" name="serviceLevelId" value="2020"
onclick="javascript:selectServiceLevel();"> <label>Full Service</label>
<div style="padding:1em 1em 1em 5em;">
<label>Services Provided:</label><br/>
<ul>
<li>Online Plan Establishment</li>
<li>Review of Investment Options</li>
<li>Semi-Annual and Annual Plan Review</li>
<li>On Going Participant Education</li>
</ul>
<table width="80%" class="withHeader" style="border:1px solid black;">
<colgroup>
<col width="10%" align="center"/>
<col width="45%" align="right"/>
<col width="45%" align="right"/>
</colgroup>
<thead>
<tr class="header">
<th align="center">Tier</th>
<th align="right">Asset Ceiling</th>
<th align="right">Rate</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center"><b>1.</b></td>
<td align="right">$999,999,999,999.00</td>
<td align="right"> <select id="serviceLevels[1].serviceLevelTiers[0].selectedRate" name="serviceLevels[1].serviceLevelTiers[0].selectedRate" >
<option value="1.00%"
selected="selected"
>
1.00%</option>
</select>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
<fieldset class="buttons">
<input name="nextStepButton" id="nextStepButton" type="submit" value="Next Step" class="wideButton">
</fieldset>
</form>
<script language="javascript" type="text/javascript">
function selectPlanAdvisor() {
var advisorSelect = document.getElementById('planAdvisorId');
var isDefaultAdvisor = advisorSelect.value == 0;
var radioButtons = document.getElementsByName('serviceLevelId');
var selectNamePattern = null;
for (i = 0; i < radioButtons.length; i++) {
if (radioButtons[i].checked) {
selectNamePattern = 'serviceLevels[' + i + ']';
}
radioButtons[i].disabled = isDefaultAdvisor;
}
var selectFields = document.getElementsByTagName('select');
for (i = 1; i < selectFields.length; i++) {
selectFields[i].disabled = isDefaultAdvisor || selectFields[i].name.indexOf(selectNamePattern) < 0;
}
}
function selectServiceLevel() {
var radioButtons = document.getElementsByName('serviceLevelId');
var selectNamePattern = null;
for (i = 0; i < radioButtons.length; i++) {
if (radioButtons[i].checked) {
selectNamePattern = 'serviceLevels[' + i + ']';
break;
}
}
var selectFields = document.getElementsByTagName('select');
for (i = 1; i < selectFields.length; i++) {
selectFields[i].disabled = selectFields[i].name.indexOf(selectNamePattern) < 0;
}
}
selectServiceLevel(); // Sync initial service level selection.
selectPlanAdvisor(); // Sync initial plan advisor selection.
</script>
|
|
Description
|
Writing script for a page where selecting certain items will cause other radio buttons further down the page to enable so you can select those too. This worked manually, but when the Watir script selected the item, the other radio buttons were not enabled. I worked around by coming back to the page, but that was clumsy.
I did get an answer for how to do this from Zeljko and it worked, but Bret said this should be entered as a bug.
This was the solution:
ie.select_list(:id, "planAdvisorId").select("Lastname, Firstname")
ie.select_list(:id, "planAdvisorId").fire_event("onclick")
This was the javascript:
<form method="post" action="">
<p>
Enter the plan's <b>Tax ID</b> (EIN), an optional <b>Promo Code</b> and select a <b>Product Fee Schedule</b>.
</p>
<table width="100%">
<colgroup>
<col id="labels"/>
<col id="fields"/>
</colgroup>
<tbody>
<tr>
<td><label>Tax ID:</label></td>
<td>
<input type="text" id="taxId" name="taxId" value="" size="12" maxlength="10"> <br/>
</td>
</tr>
<tr>
<td><label>Promo Code:</label></td>
<td>
<input type="text" id="promoCode" name="promoCode" value="" size="12" maxlength="3"> <br/>
</td>
</tr>
<tr>
<td valign="top"><label>Product Fee Schedule:</label></td>
<td style="background-color:#eee;">
<input type="radio" id="productFeeScheduleId" name="productFeeScheduleId" value="15"
checked="checked"
> Unknown <br/>
<input type="radio" id="productFeeScheduleId" name="productFeeScheduleId" value="2"
> pretend unbundled <br/>
</td>
</tr>
</tbody>
</table>
<p>
When establishing the plan on behalf of an advisor, you must also select the <b>Plan Advisor</b>,
the advisor's <b>Service Level</b> and associated <b>Rate</b>(s).
</p>
<table width="100%">
<colgroup>
<col id="labels"/>
<col id="fields"/>
</colgroup>
<tbody>
<tr>
<td><label>Plan Advisor:</label></td>
<td> <select id="planAdvisorId" name="planAdvisorId" onclick="javascript:selectPlanAdvisor();">
<option value="0"
selected="selected"
>
No Advisor</option>
<option value="138886"
>
Lastname, Firstname</option>
</select>
</td>
</tr>
<tr>
<td valign="top"><label>Service Level:</label></td>
<td style="background-color:#eee;">
<input type="radio" id="serviceLevelId" name="serviceLevelId" value="2010"
checked="checked" onclick="javascript:selectServiceLevel();"> <label>Basic Service</label>
<div style="padding:1em 1em 1em 5em;">
<label>Services Provided:</label><br/>
<ul>
<li>Online Plan Establishment</li>
<li>Review of Investment Options</li>
<li>Annual Plan Review</li>
</ul>
<table width="80%" class="withHeader" style="border:1px solid black;">
<colgroup>
<col width="10%" align="center"/>
<col width="45%" align="right"/>
<col width="45%" align="right"/>
</colgroup>
<thead>
<tr class="header">
<th align="center">Tier</th>
<th align="right">Asset Ceiling</th>
<th align="right">Rate</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center"><b>1.</b></td>
<td align="right">$999,999,999,999.00</td>
<td align="right"> <select id="serviceLevels[0].serviceLevelTiers[0].selectedRate" name="serviceLevels[0].serviceLevelTiers[0].selectedRate" >
<option value="0.50%"
selected="selected"
>
0.50%</option>
</select>
</td>
</tr>
</tbody>
</table>
</div>
<input type="radio" id="serviceLevelId" name="serviceLevelId" value="2020"
onclick="javascript:selectServiceLevel();"> <label>Full Service</label>
<div style="padding:1em 1em 1em 5em;">
<label>Services Provided:</label><br/>
<ul>
<li>Online Plan Establishment</li>
<li>Review of Investment Options</li>
<li>Semi-Annual and Annual Plan Review</li>
<li>On Going Participant Education</li>
</ul>
<table width="80%" class="withHeader" style="border:1px solid black;">
<colgroup>
<col width="10%" align="center"/>
<col width="45%" align="right"/>
<col width="45%" align="right"/>
</colgroup>
<thead>
<tr class="header">
<th align="center">Tier</th>
<th align="right">Asset Ceiling</th>
<th align="right">Rate</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center"><b>1.</b></td>
<td align="right">$999,999,999,999.00</td>
<td align="right"> <select id="serviceLevels[1].serviceLevelTiers[0].selectedRate" name="serviceLevels[1].serviceLevelTiers[0].selectedRate" >
<option value="1.00%"
selected="selected"
>
1.00%</option>
</select>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
<fieldset class="buttons">
<input name="nextStepButton" id="nextStepButton" type="submit" value="Next Step" class="wideButton">
</fieldset>
</form>
<script language="javascript" type="text/javascript">
function selectPlanAdvisor() {
var advisorSelect = document.getElementById('planAdvisorId');
var isDefaultAdvisor = advisorSelect.value == 0;
var radioButtons = document.getElementsByName('serviceLevelId');
var selectNamePattern = null;
for (i = 0; i < radioButtons.length; i++) {
if (radioButtons[i].checked) {
selectNamePattern = 'serviceLevels[' + i + ']';
}
radioButtons[i].disabled = isDefaultAdvisor;
}
var selectFields = document.getElementsByTagName('select');
for (i = 1; i < selectFields.length; i++) {
selectFields[i].disabled = isDefaultAdvisor || selectFields[i].name.indexOf(selectNamePattern) < 0;
}
}
function selectServiceLevel() {
var radioButtons = document.getElementsByName('serviceLevelId');
var selectNamePattern = null;
for (i = 0; i < radioButtons.length; i++) {
if (radioButtons[i].checked) {
selectNamePattern = 'serviceLevels[' + i + ']';
break;
}
}
var selectFields = document.getElementsByTagName('select');
for (i = 1; i < selectFields.length; i++) {
selectFields[i].disabled = selectFields[i].name.indexOf(selectNamePattern) < 0;
}
}
selectServiceLevel(); // Sync initial service level selection.
selectPlanAdvisor(); // Sync initial plan advisor selection.
</script> |
Show » |
| There are no comments yet on this issue.
|
|