Codeaddict7423
asked on
getting value from a textbox via javascript
Hello,
I have a javascript code that I'm editing to collect user input and write to a database table.
The code is as follows:
--------
<script language="JavaScript" type="text/javascript">
<!--
function showSelected()
{
form = document.forms[0];
var selObj = document.getElementById('s ponsorship level');
//var txtIndexObj = document.getElementById('t xtIndex');
var ScholarshipAmountObj = document.getElementById('t xtScholars hipAmount' );
var txtValueObj = document.getElementById('t xtValue');
//var txtTextObj = document.getElementById('t xtText');
var txtSponsorshipAmountObj = document.getElementById("c tl00_ctl00 _cphPage_c phContent_ SpecialCon trol_RSVPF orm1_Spons orshipAmou nt");
var hdnTotalObj = document.getElementById('h dnTotal');
var selIndex = selObj.selectedIndex;
var sponsoramt = ScholarshipAmountObj.value ;
var obj1 = document.getElementById("c tl00_ctl00 _cphPage_c phContent_ SpecialCon trol_RSVPF orm1_Spons orshipAmou nt");
var txtScholarshipAmountObj = document.getElementById('c tl00_ctl00 _cphPage_c phContent_ SpecialCon trol_RSVPF orm1_Schol arshipAmou nt');
obj1.value = selIndex;
txtValueObj.value = selObj.options[selIndex].v alue;
// if i change selObj.options[selIndex].v alue to "text" i see only the names of the options in ddl
//this is where i added this line to capture sponsorship levels
// txtSponsorshipAmountObj.va lue = selObj.options[selIndex].t ext;
txtSponsorshipAmountObj.va lue = selObj.options[selIndex].v alue;
txtScholarshipAmountObj.va lue = ScholarshipAmountObj.optio ns[sponsor amt].value ;
hdnTotalObj.value = txtValueObj.value;
obj.value = form.Total.value;
// obj1.value = parseFloat(form.txtValue.v alue);
//txtScholarshipAmountObj. value = parseFloat(form.txtScholar shipAmount .value);
}
//-->
</script>
------------
the code that drives this functions follows:
------
<tr>
<td colspan="3" style="width:100%" valign="top" align="left"><strong><span style="color:crimson">Scho larship Donation</span></strong></ td>
</tr>
<tr>
<td colspan="3" style="width:100%" valign="top" align="center"> </td>
</tr>
<!--this will be input C for scholarship donations -->
<tr>
<td style="width:33%" valign="top" align="right">Donation Amount </td>
<td style="width:33%" valign="top" align="left">
<input type="text" id="txtScholarshipAmount" name="input_C" size="10" value="0" onblur="OnCalculateTotal(t his.form.i nput_B.val ue, this.form.input_C.value, this.form)" />
<asp:HiddenField ID="ScholarshipAmount" runat="server" Visible="true"/>
</td>
<td style="width:33%; background-color:#ffffff" valign="top" align="left" > </td>
</tr>
---------
I am missing the last part of this puzzle which is detecting data written to a textbox
called "txtScholarshipAmount" and t his is what i need to detect the input from and write to database.
ANY help would be greatly appreciated.
I have a javascript code that I'm editing to collect user input and write to a database table.
The code is as follows:
--------
<script language="JavaScript" type="text/javascript">
<!--
function showSelected()
{
form = document.forms[0];
var selObj = document.getElementById('s
//var txtIndexObj = document.getElementById('t
var ScholarshipAmountObj = document.getElementById('t
var txtValueObj = document.getElementById('t
//var txtTextObj = document.getElementById('t
var txtSponsorshipAmountObj = document.getElementById("c
var hdnTotalObj = document.getElementById('h
var selIndex = selObj.selectedIndex;
var sponsoramt = ScholarshipAmountObj.value
var obj1 = document.getElementById("c
var txtScholarshipAmountObj = document.getElementById('c
obj1.value = selIndex;
txtValueObj.value = selObj.options[selIndex].v
// if i change selObj.options[selIndex].v
//this is where i added this line to capture sponsorship levels
// txtSponsorshipAmountObj.va
txtSponsorshipAmountObj.va
txtScholarshipAmountObj.va
hdnTotalObj.value = txtValueObj.value;
obj.value = form.Total.value;
// obj1.value = parseFloat(form.txtValue.v
//txtScholarshipAmountObj.
}
//-->
</script>
------------
the code that drives this functions follows:
------
<tr>
<td colspan="3" style="width:100%" valign="top" align="left"><strong><span
</tr>
<tr>
<td colspan="3" style="width:100%" valign="top" align="center"> </td>
</tr>
<!--this will be input C for scholarship donations -->
<tr>
<td style="width:33%" valign="top" align="right">Donation Amount </td>
<td style="width:33%" valign="top" align="left">
<input type="text" id="txtScholarshipAmount" name="input_C" size="10" value="0" onblur="OnCalculateTotal(t
<asp:HiddenField ID="ScholarshipAmount" runat="server" Visible="true"/>
</td>
<td style="width:33%; background-color:#ffffff" valign="top" align="left" > </td>
</tr>
---------
I am missing the last part of this puzzle which is detecting data written to a textbox
called "txtScholarshipAmount" and t his is what i need to detect the input from and write to database.
ANY help would be greatly appreciated.
document.getElementById('t xtScholars hipAmount' ).value
If you are working on a usercontrol, this might work:
var txtScholarshipAmountText = "<%=txtScholarshipAmount.T ext%>"
var txtScholarshipAmountText = "<%=txtScholarshipAmount.T
ASKER
tan dev,
Thank you for your suggestion. I've tried everything i know. below, please find my javascript code:
--------
<script language="JavaScript" type="text/javascript">
<!--
function showSelected()
{
form = document.forms[0];
var selObj = document.getElementById('s ponsorship level');
//var txtIndexObj = document.getElementById('t xtIndex');
var ScholarshipAmountObj = document.getElementById('t xtScholars hipAmount' );
var txtValueObj = document.getElementById('t xtValue');
//var txtTextObj = document.getElementById('t xtText');
var txtSponsorshipAmountObj = document.getElementById("c tl00_ctl00 _cphPage_c phContent_ SpecialCon trol_RSVPF orm1_Spons orshipAmou nt");
//var txtScholarshipAmountObj = document.getElementById('t xtScholars hipAmount' );
var hdnTotalObj = document.getElementById('h dnTotal');
var selIndex = selObj.selectedIndex;
var sponsoramt = ScholarshipAmountObj.value ;
var obj1 = document.getElementById("c tl00_ctl00 _cphPage_c phContent_ SpecialCon trol_RSVPF orm1_Spons orshipAmou nt");
var txtScholarshipAmountText = "<%=txtScholarshipAmount.T ext%>"
//var obj2 = document.getElementById('t xtScholars hipAmount' ).value;
obj1.value = selIndex;
txtValueObj.value = selObj.options[selIndex].v alue;
// if i change selObj.options[selIndex].v alue to "text" i see only the names of the options in ddl
//this is where i added this line to capture sponsorship levels
// txtSponsorshipAmountObj.va lue = selObj.options[selIndex].t ext;
txtSponsorshipAmountObj.va lue = selObj.options[selIndex].v alue;
// txtValueObj.value = selObj.options[selIndex].v alue;
txtScholarshipAmountObj.va lue = form.txtScholarshipAmount. value;
obj2.value = form.txtScholarshipAmount. value;
hdnTotalObj.value = txtValueObj.value;
obj.value = form.Total.value;
// obj1.value = parseFloat(form.txtValue.v alue);
//txtScholarshipAmountObj. value = parseFloat(form.txtScholar shipAmount .value);
}
//-->
</script>
--------
the code call is like this:
-------
<tr>
<td colspan="3" style="width:100%" valign="top" align="left"><strong><span style="color:crimson">Scho larship Donation</span></strong></ td>
</tr>
<tr>
<td colspan="3" style="width:100%" valign="top" align="center"> </td>
</tr>
<!--this will be input C for scholarship donations -->
<tr>
<td style="width:33%" valign="top" align="right">Donation Amount </td>
<td style="width:33%" valign="top" align="left">
<input type="text" id="txtScholarshipAmount" name="input_C" size="10" value="0" onblur="OnCalculateTotal(t his.form.i nput_B.val ue, this.form.input_C.value, this.form)" />
<asp:HiddenField ID="ScholarshipAmount" runat="server" Visible="true"/>
</td>
<td style="width:33%; background-color:#ffffff" valign="top" align="left" > </td>
</tr>
----------
ANY help would be greatly appreciated.
Thank you for your suggestion. I've tried everything i know. below, please find my javascript code:
--------
<script language="JavaScript" type="text/javascript">
<!--
function showSelected()
{
form = document.forms[0];
var selObj = document.getElementById('s
//var txtIndexObj = document.getElementById('t
var ScholarshipAmountObj = document.getElementById('t
var txtValueObj = document.getElementById('t
//var txtTextObj = document.getElementById('t
var txtSponsorshipAmountObj = document.getElementById("c
//var txtScholarshipAmountObj = document.getElementById('t
var hdnTotalObj = document.getElementById('h
var selIndex = selObj.selectedIndex;
var sponsoramt = ScholarshipAmountObj.value
var obj1 = document.getElementById("c
var txtScholarshipAmountText = "<%=txtScholarshipAmount.T
//var obj2 = document.getElementById('t
obj1.value = selIndex;
txtValueObj.value = selObj.options[selIndex].v
// if i change selObj.options[selIndex].v
//this is where i added this line to capture sponsorship levels
// txtSponsorshipAmountObj.va
txtSponsorshipAmountObj.va
// txtValueObj.value = selObj.options[selIndex].v
txtScholarshipAmountObj.va
obj2.value = form.txtScholarshipAmount.
hdnTotalObj.value = txtValueObj.value;
obj.value = form.Total.value;
// obj1.value = parseFloat(form.txtValue.v
//txtScholarshipAmountObj.
}
//-->
</script>
--------
the code call is like this:
-------
<tr>
<td colspan="3" style="width:100%" valign="top" align="left"><strong><span
</tr>
<tr>
<td colspan="3" style="width:100%" valign="top" align="center"> </td>
</tr>
<!--this will be input C for scholarship donations -->
<tr>
<td style="width:33%" valign="top" align="right">Donation Amount </td>
<td style="width:33%" valign="top" align="left">
<input type="text" id="txtScholarshipAmount" name="input_C" size="10" value="0" onblur="OnCalculateTotal(t
<asp:HiddenField ID="ScholarshipAmount" runat="server" Visible="true"/>
</td>
<td style="width:33%; background-color:#ffffff" valign="top" align="left" > </td>
</tr>
----------
ANY help would be greatly appreciated.
did you try this:
var txtScholarshipAmountText = "<%=txtScholarshipAmount.T ext%>"
it should work everytime. Is it just txtScholarshipAmount value you cant read? What about txtValue? Can you read that? Where are you calling showSelected()
var txtScholarshipAmountText = "<%=txtScholarshipAmount.T
it should work everytime. Is it just txtScholarshipAmount value you cant read? What about txtValue? Can you read that? Where are you calling showSelected()
ASKER
tan dev,
Thank you for your insight.
I implemented your code and I'm getting a compilation error as follows:
------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30451: Name 'txtScholarshipAmount' is not declared.
Source Error:
Line 116:
Line 117:
Line 118: var txtScholarshipAmountText = "<%=txtScholarshipAmount.T ext%>"
Line 119:
Line 120: //var obj2 = document.getElementById('t xtScholars hipAmount' ).value;
Source File: Y:\default\main\www\WORKAR EA\Common\ htdocs\uc\ RSVP\RSVP_ GISDaySpon sors.ascx Line: 118
------
can youi please help?
Thank you for your insight.
I implemented your code and I'm getting a compilation error as follows:
------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30451: Name 'txtScholarshipAmount' is not declared.
Source Error:
Line 116:
Line 117:
Line 118: var txtScholarshipAmountText = "<%=txtScholarshipAmount.T
Line 119:
Line 120: //var obj2 = document.getElementById('t
Source File: Y:\default\main\www\WORKAR
------
can youi please help?
ASKER
tan dev,
I changed my script as follows:
----
<script language="JavaScript" type="text/javascript">
<!--
function showSelected()
{
form = document.forms[0];
var selObj = document.getElementById('s ponsorship level');
//var txtIndexObj = document.getElementById('t xtIndex');
var ScholarshipAmountObj = document.getElementById('t xtScholars hipAmount' );
var txtValueObj = document.getElementById('t xtValue');
//var txtTextObj = document.getElementById('t xtText');
var txtSponsorshipAmountObj = document.getElementById("c tl00_ctl00 _cphPage_c phContent_ SpecialCon trol_RSVPF orm1_Spons orshipAmou nt");
//var txtScholarshipAmountObj = document.getElementById('t xtScholars hipAmount' );
var hdnTotalObj = document.getElementById('h dnTotal');
var selIndex = selObj.selectedIndex;
var sponsoramt = ScholarshipAmountObj.value ;
var obj1 = document.getElementById("c tl00_ctl00 _cphPage_c phContent_ SpecialCon trol_RSVPF orm1_Spons orshipAmou nt");
//var txtScholarshipAmountText = "<%=txtScholarshipAmount.T ext%>"
var obj2 = document.getElementById('t xtScholars hipAmount' ).value;
obj1.value = selIndex;
txtValueObj.value = selObj.options[selIndex].v alue;
// if i change selObj.options[selIndex].v alue to "text" i see only the names of the options in ddl
//this is where i added this line to capture sponsorship levels
// txtSponsorshipAmountObj.va lue = selObj.options[selIndex].t ext;
txtSponsorshipAmountObj.va lue = selObj.options[selIndex].v alue;
// txtValueObj.value = selObj.options[selIndex].v alue;
txtScholarshipAmountObj.va lue = form.txtScholarshipAmount. value;
txtScholarshipAmountText.t ext = form.txtScholarshipAmount. text;
hdnTotalObj.value = txtValueObj.value;
obj.value = form.Total.value;
// obj1.value = parseFloat(form.txtValue.v alue);
//txtScholarshipAmountObj. value = parseFloat(form.txtScholar shipAmount .value);
}
//-->
</script>
-----
the call to this script is as follows:
----------
<input type="text" id="txtScholarshipAmount" name="input_C" size="10" value="0" onchange="showSelected();" onblur="OnCalculateTotal(t his.form.i nput_B.val ue, this.form.input_C.value, this.form)" />
------
Can you please review?
I changed my script as follows:
----
<script language="JavaScript" type="text/javascript">
<!--
function showSelected()
{
form = document.forms[0];
var selObj = document.getElementById('s
//var txtIndexObj = document.getElementById('t
var ScholarshipAmountObj = document.getElementById('t
var txtValueObj = document.getElementById('t
//var txtTextObj = document.getElementById('t
var txtSponsorshipAmountObj = document.getElementById("c
//var txtScholarshipAmountObj = document.getElementById('t
var hdnTotalObj = document.getElementById('h
var selIndex = selObj.selectedIndex;
var sponsoramt = ScholarshipAmountObj.value
var obj1 = document.getElementById("c
//var txtScholarshipAmountText = "<%=txtScholarshipAmount.T
var obj2 = document.getElementById('t
obj1.value = selIndex;
txtValueObj.value = selObj.options[selIndex].v
// if i change selObj.options[selIndex].v
//this is where i added this line to capture sponsorship levels
// txtSponsorshipAmountObj.va
txtSponsorshipAmountObj.va
// txtValueObj.value = selObj.options[selIndex].v
txtScholarshipAmountObj.va
txtScholarshipAmountText.t
hdnTotalObj.value = txtValueObj.value;
obj.value = form.Total.value;
// obj1.value = parseFloat(form.txtValue.v
//txtScholarshipAmountObj.
}
//-->
</script>
-----
the call to this script is as follows:
----------
<input type="text" id="txtScholarshipAmount" name="input_C" size="10" value="0" onchange="showSelected();"
------
Can you please review?
is your text box displaying the right value through OnCalculate function?
<input type="text" id="txtScholarshipAmount" name="input_C" size="10" value="0" onblur="OnCalculateTotal(t his.form.i nput_B.val ue, this.form.input_C.value, this.form)" />
if you were using document.getElementById('t xtScholars hipAmount' ); to get the values of all other textboxes and the only one that wasnt working was for txtScholarshipAmount. then i dont think the problem is in the code trying to retrieve the value i.e. there is no problem with your document.getElement method. In that case one out of two things might be wrong:
1. You oncalculate is not working fine. You can tell this if your textbox is displaying the right value or not.
2. Your onblur of textbox is calculating the txtScholarshipAmount value after your showSelected() function is being called. Hence showSelected() isnt getting the value of txtScholarshipAmount
<input type="text" id="txtScholarshipAmount" name="input_C" size="10" value="0" onblur="OnCalculateTotal(t
if you were using document.getElementById('t
1. You oncalculate is not working fine. You can tell this if your textbox is displaying the right value or not.
2. Your onblur of textbox is calculating the txtScholarshipAmount value after your showSelected() function is being called. Hence showSelected() isnt getting the value of txtScholarshipAmount
I do think whats happening is your value isnt getting calculated using OnCalculateTotal before you are processing it in showSelected().
why dont you use one event to call both functions one after the other.
<input type="text" id="txtScholarshipAmount" name="input_C" size="10" value="0" onblur="OnCalculateTotal(t his.form.i nput_B.val ue, this.form.input_C.value, this.form)" />
and inside
OnCalculateTotal()
{
//do everything else
showSelected();
}
why dont you use one event to call both functions one after the other.
<input type="text" id="txtScholarshipAmount" name="input_C" size="10" value="0" onblur="OnCalculateTotal(t
and inside
OnCalculateTotal()
{
//do everything else
showSelected();
}
ASKER
tan dev,
you read my mind. I was thinking of calling two different functions as follows:
------
<input type="text" id="txtScholarshipAmount" name="input_C" size="10" value="0" onblur="(showSelected() && OnCalculateTotal(this.form .input_B.v alue, this.form.input_C.value, this.form)" />
------
you read my mind. I was thinking of calling two different functions as follows:
------
<input type="text" id="txtScholarshipAmount" name="input_C" size="10" value="0" onblur="(showSelected() && OnCalculateTotal(this.form
------
ASKER
tan_dev,
I'm trying to make this work and not having any success. My javascript code follows:
---------
<script language="JavaScript" type="text/javascript">
<!--
function showSelected()
{
form = document.forms[0];
var selObj = document.getElementById('s ponsorship level');
//var txtIndexObj = document.getElementById('t xtIndex');
var ScholarshipAmountObj = document.getElementById('t xtScholars hipAmount' );
var txtValueObj = document.getElementById('t xtValue');
//var txtTextObj = document.getElementById('t xtText');
var txtSponsorshipAmountObj = document.getElementById("c tl00_ctl00 _cphPage_c phContent_ SpecialCon trol_RSVPF orm1_Spons orshipAmou nt");
//var txtScholarshipAmountObj = document.getElementById('t xtScholars hipAmount' );
var hdnTotalObj = document.getElementById('h dnTotal');
var selIndex = selObj.selectedIndex;
var sponsoramt = ScholarshipAmountObj.value ;
var obj1 = document.getElementById("c tl00_ctl00 _cphPage_c phContent_ SpecialCon trol_RSVPF orm1_Spons orshipAmou nt");
var obj2 = document.getElementById('t xtScholars hipAmount' ).value;
obj1.value = selIndex;
txtValueObj.value = selObj.options[selIndex].v alue;
// if i change selObj.options[selIndex].v alue to "text" i see only the names of the options in ddl
//this is where i added this line to capture sponsorship levels
// txtSponsorshipAmountObj.va lue = selObj.options[selIndex].t ext;
txtSponsorshipAmountObj.va lue = selObj.options[selIndex].v alue;
// txtValueObj.value = selObj.options[selIndex].v alue;
txtScholarshipAmountObj.va lue = form.txtScholarshipAmount. value;
txtScholarshipAmountText.t ext = form.txtScholarshipAmount. text;
hdnTotalObj.value = txtValueObj.value;
obj.value = form.Total.value;
// obj1.value = parseFloat(form.txtValue.v alue);
//txtScholarshipAmountObj. value = parseFloat(form.txtScholar shipAmount .value);
}
//-->
</script>
<script language="javascript" >
function CalculateTotal(Btext,Ctext , form)
{
var B = parseFloat(Btext);
var C = parseFloat(Ctext);
//var D = parseFloat(Dtext);
form._Total.value = B + C ;
//form.EnableViewState= true;
//alert("is this working");
}
/* ClearForm: this function has 1 argument: form.
It clears the input and answer fields on the form.
It needs to know the names of the INPUT elements in order
to do this. */
function ClearForm(form)
{
form.input_B.value = "";
form.input_C.value = "";
form.input_D.value = "";
form._Total.value = "";
}
// end of JavaScript functions -->
</script>
<script language="javascript" >
function OnCalculateTotal(Btext,Cte xt, form)
{
var B = parseFloat(Btext);
var C = parseFloat(Ctext);
var obj2 = document.getElementById('t xtScholars hipAmount' ).value;
//var D = parseFloat(Dtext);
var obj = document.getElementById(hd nTotalId);
obj.value = form.Total.value = B + C ;
obj2.value = form.txtScholarshipAmount. value;
function showSelected();
}
</script>
------------
the call to this is as follows:
------
<input type="text" id="txtScholarshipAmount" name="input_C" size="10" value="0" onblur="OnCalculateTotal(t his.form.i nput_B.val ue, this.form.input_C.value, this.form)" />
--------
however, the calculation is not working. can you please review?
I'm trying to make this work and not having any success. My javascript code follows:
---------
<script language="JavaScript" type="text/javascript">
<!--
function showSelected()
{
form = document.forms[0];
var selObj = document.getElementById('s
//var txtIndexObj = document.getElementById('t
var ScholarshipAmountObj = document.getElementById('t
var txtValueObj = document.getElementById('t
//var txtTextObj = document.getElementById('t
var txtSponsorshipAmountObj = document.getElementById("c
//var txtScholarshipAmountObj = document.getElementById('t
var hdnTotalObj = document.getElementById('h
var selIndex = selObj.selectedIndex;
var sponsoramt = ScholarshipAmountObj.value
var obj1 = document.getElementById("c
var obj2 = document.getElementById('t
obj1.value = selIndex;
txtValueObj.value = selObj.options[selIndex].v
// if i change selObj.options[selIndex].v
//this is where i added this line to capture sponsorship levels
// txtSponsorshipAmountObj.va
txtSponsorshipAmountObj.va
// txtValueObj.value = selObj.options[selIndex].v
txtScholarshipAmountObj.va
txtScholarshipAmountText.t
hdnTotalObj.value = txtValueObj.value;
obj.value = form.Total.value;
// obj1.value = parseFloat(form.txtValue.v
//txtScholarshipAmountObj.
}
//-->
</script>
<script language="javascript" >
function CalculateTotal(Btext,Ctext
{
var B = parseFloat(Btext);
var C = parseFloat(Ctext);
//var D = parseFloat(Dtext);
form._Total.value = B + C ;
//form.EnableViewState= true;
//alert("is this working");
}
/* ClearForm: this function has 1 argument: form.
It clears the input and answer fields on the form.
It needs to know the names of the INPUT elements in order
to do this. */
function ClearForm(form)
{
form.input_B.value = "";
form.input_C.value = "";
form.input_D.value = "";
form._Total.value = "";
}
// end of JavaScript functions -->
</script>
<script language="javascript" >
function OnCalculateTotal(Btext,Cte
{
var B = parseFloat(Btext);
var C = parseFloat(Ctext);
var obj2 = document.getElementById('t
//var D = parseFloat(Dtext);
var obj = document.getElementById(hd
obj.value = form.Total.value = B + C ;
obj2.value = form.txtScholarshipAmount.
function showSelected();
}
</script>
------------
the call to this is as follows:
------
<input type="text" id="txtScholarshipAmount" name="input_C" size="10" value="0" onblur="OnCalculateTotal(t
--------
however, the calculation is not working. can you please review?
is your calculation not correct?
i think there might be something wrong with this:
var obj2 = document.getElementById('t xtScholars hipAmount' ).value;
you are defining obj2 as a value of textbox not a textbox. try this:
i think there might be something wrong with this:
var obj2 = document.getElementById('t
you are defining obj2 as a value of textbox not a textbox. try this:
function OnCalculateTotal(Btext,Ctext, form)
{
var B = parseFloat(Btext);
var C = parseFloat(Ctext);
var obj2 = document.getElementById('txtScholarshipAmount');
//var D = parseFloat(Dtext);
var obj = document.getElementById(hdnTotalId);
obj.value = form.Total.value = B + C ;
obj2.value = form.txtScholarshipAmount.value;
function showSelected();
}
ASKER
tan_dev,
I think this may be the issue:
below, please find my javascript:
-------------------
<script language="javascript" >
function CalculateTotal(Btext,Ctext , form)
{
var B = parseFloat(Btext);
var C = parseFloat(Ctext);
//var D = parseFloat(Dtext);
C = form.input_C.value;
form._Total.value = B + C ;
//form.EnableViewState= true;
//alert("is this working");
}
/* ClearForm: this function has 1 argument: form.
It clears the input and answer fields on the form.
It needs to know the names of the INPUT elements in order
to do this. */
function ClearForm(form)
{
form.input_B.value = "";
form.input_C.value = "";
form.input_D.value = "";
form._Total.value = "";
}
// end of JavaScript functions -->
</script>
<script language="javascript" >
function OnCalculateTotal(Btext,Cte xt, form)
{
var B = parseFloat(Btext);
var C = parseFloat(Ctext);
//var D = parseFloat(Dtext);
var obj = document.getElementById(hd nTotalId);
var obj2 = document.getElementById('t xtScholars hipAmount' ).value;
obj.value = form.Total.value = B + C ;
obj2.value = form.txtScholarshipAmount. value;
}
</script>
------------------
below is the cal to this script:
-----
<input type="text" id="txtScholarshipAmount" name="input_C" size="10" value="0" onblur="OnCalculateTotal(t his.form.i nput_B.val ue, this.form.input_C.value, this.form)" />
<asp:HiddenField ID="ScholarshipAmount" runat="server" Visible="true"/>
-----
I'm stil not getting the "scholarshipamount" field to the database. ANY help would be greatly appreciated.
I think this may be the issue:
below, please find my javascript:
-------------------
<script language="javascript" >
function CalculateTotal(Btext,Ctext
{
var B = parseFloat(Btext);
var C = parseFloat(Ctext);
//var D = parseFloat(Dtext);
C = form.input_C.value;
form._Total.value = B + C ;
//form.EnableViewState= true;
//alert("is this working");
}
/* ClearForm: this function has 1 argument: form.
It clears the input and answer fields on the form.
It needs to know the names of the INPUT elements in order
to do this. */
function ClearForm(form)
{
form.input_B.value = "";
form.input_C.value = "";
form.input_D.value = "";
form._Total.value = "";
}
// end of JavaScript functions -->
</script>
<script language="javascript" >
function OnCalculateTotal(Btext,Cte
{
var B = parseFloat(Btext);
var C = parseFloat(Ctext);
//var D = parseFloat(Dtext);
var obj = document.getElementById(hd
var obj2 = document.getElementById('t
obj.value = form.Total.value = B + C ;
obj2.value = form.txtScholarshipAmount.
}
</script>
------------------
below is the cal to this script:
-----
<input type="text" id="txtScholarshipAmount" name="input_C" size="10" value="0" onblur="OnCalculateTotal(t
<asp:HiddenField ID="ScholarshipAmount" runat="server" Visible="true"/>
-----
I'm stil not getting the "scholarshipamount" field to the database. ANY help would be greatly appreciated.
ASKER
tan_dev,
thanks for your quick reply.
below, please find my edited javascript:
------
<script language="javascript" >
function CalculateTotal(Btext,Ctext , form)
{
var B = parseFloat(Btext);
var C = parseFloat(Ctext);
//var D = parseFloat(Dtext);
C = form.input_C.value;
form._Total.value = B + C ;
//form.EnableViewState= true;
//alert("is this working");
}
/* ClearForm: this function has 1 argument: form.
It clears the input and answer fields on the form.
It needs to know the names of the INPUT elements in order
to do this. */
function ClearForm(form)
{
form.input_B.value = "";
form.input_C.value = "";
form.input_D.value = "";
form._Total.value = "";
}
// end of JavaScript functions -->
</script>
<script language="javascript" >
function OnCalculateTotal(Btext,Cte xt, form)
{
var B = parseFloat(Btext);
var C = parseFloat(Ctext);
//var D = parseFloat(Dtext);
var obj = document.getElementById(hd nTotalId);
var obj2 = document.getElementById('t xtScholars hipAmount' ).value;
obj.value = form.Total.value = B + C ;
obj2.value = form.C.value;
}
</script>
-----
my call to this scrips is as follows:
------
<input type="text" id="txtScholarshipAmount" name="input_C" size="10" value="0" onblur="OnCalculateTotal(t his.form.i nput_B.val ue, this.form.input_C.value, this.form)" />
------
The calculation is correct.
i just want to capture t he amount of the donation (input_C) that is in control "txtScholarshipAmount"
thanks for your quick reply.
below, please find my edited javascript:
------
<script language="javascript" >
function CalculateTotal(Btext,Ctext
{
var B = parseFloat(Btext);
var C = parseFloat(Ctext);
//var D = parseFloat(Dtext);
C = form.input_C.value;
form._Total.value = B + C ;
//form.EnableViewState= true;
//alert("is this working");
}
/* ClearForm: this function has 1 argument: form.
It clears the input and answer fields on the form.
It needs to know the names of the INPUT elements in order
to do this. */
function ClearForm(form)
{
form.input_B.value = "";
form.input_C.value = "";
form.input_D.value = "";
form._Total.value = "";
}
// end of JavaScript functions -->
</script>
<script language="javascript" >
function OnCalculateTotal(Btext,Cte
{
var B = parseFloat(Btext);
var C = parseFloat(Ctext);
//var D = parseFloat(Dtext);
var obj = document.getElementById(hd
var obj2 = document.getElementById('t
obj.value = form.Total.value = B + C ;
obj2.value = form.C.value;
}
</script>
-----
my call to this scrips is as follows:
------
<input type="text" id="txtScholarshipAmount" name="input_C" size="10" value="0" onblur="OnCalculateTotal(t
------
The calculation is correct.
i just want to capture t he amount of the donation (input_C) that is in control "txtScholarshipAmount"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.