Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 27th, 2004, 08:58 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 119
Thanks: 0
Thanked 1 Time in 1 Post
Default Question on dynamic changes to other form elements

I have a set of CHECKBOXES where if I check one of those checkboxes then one of a set of RADIO BUTTONS needs to be selected in the same form in addition to populating a textbox with the contents of a variable in my form that corresponds to the checkbox being checked. I am having problems trying to get this done. I've tried the following but to no avail.

Any suggestions or direction would be appreciated.

Here is the code for one of my checkboxes:
<tr>
    <td align="left" nowrap><input type="checkbox" name="chkplatinum" value="platinum" onclick="this.form.sponsor_info[0].selected=1">
&nbsp;&nbsp;PLATINUM LEVEL $25,000+</td>
</tr>

And here is the code for one of my radio buttons and the textbox:
<input Type="Radio" Name="sponsor_info">
&nbsp;&nbsp;&nbsp;Sponsorship Level <b>$</b> <input type="text" name="level_amt" size="10">&nbsp;(min. amt denoted per level checked at right)<br><br>
 
Old October 27th, 2004, 10:17 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 119
Thanks: 0
Thanked 1 Time in 1 Post
Default

In response to my own question, I was trying to create a function that encapsulates both events that I am trying to do but when I call this function I am getting an error.

Here is the function:

function chkPlatinumValue()
{
    var chkplatinumamount = "25000.00";
    if (theForm.chkplatinum.checked = true)
    {
        theForm.sponsor_info.checked = true;
        theForm.level_amt.value = chkplatinumamount;
    }
}

Here is where I am calling this function:
<td align="left" nowrap><input type="checkbox" name="chkplatinum" onclick="return chkPlatinumValue();">

Here is the error:
object expected


ANY help would be appreciated. Thanks.





Similar Threads
Thread Thread Starter Forum Replies Last Post
help writing dynamic form data to dynamic table ublend Classic ASP Professional 1 June 1st, 2007 08:08 AM
Enable/Disable Form Elements Question kwilliams Javascript 4 February 28th, 2006 11:28 AM
javascript access elements of frame with dynamic . PassionForJavaJ2EE Javascript How-To 1 December 7th, 2004 11:09 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.