Click to See Complete Forum and Search --> : Does this look right?


IndyB
08-04-2003, 10:38 AM
Can you all tell me if this looks correct to you. I'm trying to take a ColdFusion variable (#url.line_amount#), manipulate it, then pass the new value back to the previous page, and close the window. Anyone see anything wrong with this? I'm not generating any errors, it's just that the link isn't pointing sending the user back to the previous page or closing the window.

<script type=text/javascript>
{
line_amount = '#url.line_amount#';
ineligible_field_name = '#page.ineligible_field#';
ineligible = 0;
if(line_amount - fee < 0 )
ineligible = 0;
else if (line_amount - fee > 0 )
ineligible = 0;
else
ineligible = line_amount - fee;
opener.document.frmname.ineligible_field_name.value = ineligible;
self.close();
}
</script>

IndyB
08-04-2003, 01:53 PM
Anyone?

SlankenOgen
08-04-2003, 02:03 PM
Try this

<script type=text/javascript>
{
line_amount = '#url.line_amount#';
ineligible_field_name = '#page.ineligible_field#';
alert(ineligible_field_name);
ineligible = 0;
if(!(line_amount - fee == 0 )) {
ineligible = 0;
}else{
ineligible = line_amount - fee;
alert(ineligible);
}
opener.document.frmname.ineligible_field_name.value = ineligible;
self.close();
}
</script>

But your code ensures that ineligible will = 0 no matter what the results of line_amount - fee is so your if statements are redundant.

IndyB
08-04-2003, 02:27 PM
Thanks for the reply.

That seems to be getting me closer to the goal. Using the code you provided, I now get a popup alert for the correct ineligible_field_name. But after i click OK, I have the same problems as before.

SlankenOgen
08-04-2003, 02:34 PM
opener.document.frmname.ineligible_field_name.value = ineligible;
self.close();


is correct. Can you post the form html from the opener.

IndyB
08-04-2003, 02:43 PM
This is sort of a mess...

<form action="popup.worksheet.cfm?claim_id=#page.claim_id#" name="frmname" method="post">
<input type="hidden" name="frmaction" value="">
<input type="hidden" name="closewin" value="">
<input type="hidden" name="claim_id" value="#page.claim_id#">
<input type="hidden" name="num_lines" value="#check_li_detail.recordcount#">

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="middle" align="left" width="50%"><input type="button" value=" Close " onclick="window.close()"></td>
<td valign="middle" align="right" width="50%"><input type="button" value=" Save " onclick="dosave('N')">&nbsp;<input type="button" value="Save & Close" onclick="dosave('Y')"></td>
</tr>
</table>

<hr size="2" noshade>
<table width="100%" border="1" cellspacing="0" cellpadding="2">

<cfloop>
<tr>
<td align="center" valign="middle" class="xsmall">#set_id#</td>
<td align="center" valign="middle" class="xsmall">#line_id#</td>
<td valign="middle" class="xsmall">
<cfif set_id is 1>#DollarFormat(li_amount_array_1[line_id])#<cfset li_amount_total = li_amount_total + li_amount_array_1[line_id]><input type="hidden" name="li_amount_#set_id#_#line_id#" value="#replace(NumberFormat(li_amount_array_1[line_id], '999999999.00'), " ", "", "All")#"><cfset line_amount_pass = #li_amount_array_1[line_id]#></cfif>
<cfif set_id is 2>#DollarFormat(li_amount_array_2[line_id])#<cfset li_amount_total = li_amount_total + li_amount_array_2[line_id]><input type="hidden" name="li_amount_#set_id#_#line_id#" value="#replace(NumberFormat(li_amount_array_2[line_id], '999999999.00'), " ", "", "All")#"><cfset line_amount_pass = #li_amount_array_2[line_id]#></cfif>
</td>
<td valign="middle" class="xsmall">$<input type="text" name="ppo_allowed_#set_id#_#line_id#" value="#loop.ppo_allowed#" size="12" class="xsmall" style="{vertical-align:middle;}" onchange="this.value=currencyFormat(this.value);calculate_payable(#set_id#,#line_id#,'Y');dototal('ppoallowed' );" onBlur="this.value=currencyFormat(this.value);calculate_payable(#set_id#,#line_id#,'Y');dototal('ppo_allowed ');"></td>
<td valign="middle" class="xsmall">$<input type="text" name="deductible_#set_id#_#line_id#" value="#loop.deductible#" size="12" class="xsmall" style="{vertical-align:middle;}" onchange="this.value=currencyFormat(this.value);dototal('deductible');calculate_payable(#set_id#,#line_id#,'Y' );" onBlur="this.value=currencyFormat(this.value);dototal('deductible');calculate_payable(#set_id#,#line_id#,'Y' );"></td>
<td valign="middle" class="xsmall">$<input type="text" name="ineligible_#set_id#_#line_id#" value="#loop.ineligible#" size="12" class="xsmall" style="{vertical-align:middle;}" onchange="this.value=currencyFormat(this.value);dototal('ineligible');calculate_payable(#set_id#,#line_id#,'Y' );" onBlur="this.value=currencyFormat(this.value);dototal('ineligible');calculate_payable(#set_id#,#line_id#,'Y' );"></td>
<td valign="middle" class="xsmall"><input type="text" name="payable_percent_#set_id#_#line_id#" value="#loop.payable_percent#" size="3" class="xsmall" style="{vertical-align:middle;}" onchange="this.value=reformatPercentage(this.value);calculate_payable(#set_id#,#line_id#,'Y');" onblur="this.value=reformatPercentage(this.value);calculate_payable(#set_id#,#line_id#,'Y');">%</td>
<td valign="middle" class="xsmall">$<input type="text" name="payable_amount_#set_id#_#line_id#" value="#loop.payable_amount#" size="12" class="xsmall" style="{border: 0px;vertical-align:middle;}" readonly></td>
<cfif claim_info.policy_id IS 3>
<cfset ineligible_field = "ineligible_"&#set_id#&"_"&#line_id#>
<td valign="middle" class="xsmall" align="center"><a href="javascript: worksheet(#page.claim_id#,#set_id#,#line_id#,'#line_amount_pass#','#ineligible_field#')"><img src="/pics/button.magnify.gif" width="17" height="21" border="0"></a></td>
<script>
function worksheet(claim_id,set_id,line_id,line_amount_pass,ineligible_field)
{
url = "/application/claims/admin/adjudicate/popup.worksheet.fee_schedule.cfm?claim_id="+claim_id+"&set_id="+set_id+"&line_id="+line_id+"&line_amount="+line_amount_pass+"&ineligible_field="+ineligible_field;
dopopup(url,'#replace(createuuid(), "-", "_", "All")#',Number(screen.availWidth-200),Number(screen.availHeight-300),0,0,'yes','yes','yes','yes','yes','yes','yes','yes','yes','yes');
}
</script>
</cfif>

<td align="center" valign="middle" class="xsmall"><a href="javascript: alert('#IIf(benefit_code is "", DE("NA"), DE("[" & benefit_code & "] " & benefit_desc))#')" title="#IIf(benefit_code is "", DE("NA"), DE("[" & benefit_code & "] " & benefit_desc))#">#IIf(benefit_code is "", DE("NA"), DE(benefit_code))#</a>&nbsp;/&nbsp;<a href="javascript: benefitcode(#claim_id#,#set_id#,#line_id#)" title="Edit">E</a></td>
<td align="center" valign="middle" class="xsmall"><a href="javascript: alert('#IIf(classification_code is "", DE("NA"), DE("[" & classification_code & "] " & classification_desc))#')" title="#IIf(classification_code is "", DE("NA"), DE("[" & classification_code & "] " & classification_desc))#">#IIf(classification_code is "", DE("NA"), DE(classification_code))#</a>&nbsp;/&nbsp;<a href="javascript: classificationcode(#claim_id#,#set_id#,#line_id#)" title="Edit">E</a></td>
<td align="center" valign="middle" class="xsmall"><a href="javascript: alert('Remark Codes\n\n<cfloop query="remark_codes">[#remark_code#] #remark_desc#\n</cfloop>')" title="Remark Codes#chr(13)##chr(13)#<cfloop query="remark_codes">[#remark_code#] #remark_desc##chr(13)#</cfloop>">#IIf(remark_codes.recordcount is 0, DE("NA"), DE(remark_codes.recordcount))#</a>&nbsp;/&nbsp;<a href="javascript: remarkcode(#claim_id#,#set_id#,#line_id#)" title="Edit">E</a></td>
<td align="center" valign="middle" class="xsmall"><img src="#IIf(underwriter_logo is "", DE("/pics/icon_unknown.gif"), DE(underwriter_logo))#" width="18" height="18" alt="#alt_text#" align="absmiddle" border="0">&nbsp;/&nbsp;<a href="javascript: riskassignment(#claim_id#,#set_id#,#line_id#)" title="Edit">E</a></td>
<td align="center" valign="middle" class="xsmall"><input type="checkbox" name="reprice" value="#set_id#_#line_id#" #IIf(reprice is 1, DE("checked"), DE(""))#></td>
</tr>
</cfloop>

<tr bgcolor="#client.css.row0_bgcolor#">
<td align="center" valign="middle" class="xsmall" colspan="2"><b>Total</b></td>
<td valign="middle" class="xsmall">$<input type="text" name="total_li_amount" value="#li_amount_total#" size="12" class="xsmall" style="{border: 0px;vertical-align:middle;background-color:#client.css.row0_bgcolor#;}" readonly></td>
<td valign="middle" class="xsmall">$<input type="text" name="total_ppo_allowed" value="#ppo_allowed_total#" size="12" class="xsmall" style="{border: 0px;vertical-align:middle;background-color:#client.css.row0_bgcolor#;}" readonly></td>
<td valign="middle" class="xsmall">$<input type="text" name="total_deductible" value="#deductible_total#" size="12" class="xsmall" style="{border: 0px;vertical-align:middle;background-color:#client.css.row0_bgcolor#;}" readonly></td>
<td valign="middle" class="xsmall">$<input type="text" name="total_ineligible" value="#ineligible_total#" size="12" class="xsmall" style="{border: 0px;vertical-align:middle;background-color:#client.css.row0_bgcolor#;}" readonly></td>
<td valign="middle" class="xsmall">&nbsp;</td>
<td valign="middle" class="xsmall">$<input type="text" name="total_payable_amount" value="#payable_amount_total#" size="12" class="xsmall" style="{border: 0px;vertical-align:middle;background-color:#client.css.row0_bgcolor#;}" readonly></td>
<cfif claim_info.policy_id IS 3><td valign="middle" class="xsmall">&nbsp;</td></cfif>
<!--- Hawaii SHOTT information --->
<cfif check_li_detail.tpl neq "" and check_li_detail.claim_status_reason neq ""><cfset page.colspan = "7"><cfelse><cfset page.colspan="5"></cfif>
<td align="center" valign="middle" class="xsmall" colspan="#page.colspan#"><input type="button" value="Re-Calculate" onclick="calculateall()" class="xsmall"></td>
</tr>

</table>

<hr size="2" noshade>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="middle" align="left" width="50%"><input type="button" value=" Close " onclick="window.close()"></td>
<td valign="middle" align="right" width="50%"><input type="button" value=" Save " onclick="dosave('N')">&nbsp;<input type="button" value="Save & Close" onclick="dosave('Y')"></td>
</tr>
</table>
</form>

SlankenOgen
08-05-2003, 07:21 AM
You need to make a very simple form to test the code. Just a form with one text field. If that works you know the code works and can then look at the real form for glitches.