javascript simple - reading data from from

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
sokka888
Forum Newbie
Posts: 11
Joined: Sun Jan 18, 2009 7:44 pm

javascript simple - reading data from from

Post by sokka888 »

Hi Experts,

I have an simple form. when I read the value of radio button noting is returned.

When I wrote the value of the radio button it displayed "[object]" in IE 7 and in FF 3 it returned [object NodeList]

Here is the HTML code

Code: Select all

 
 <form name="screen4form" method="post">
 
<table border="0" width="400" cellspacing="0" cellpadding="0">
                   <tr valign="middle">
                     <td width="16%" class="tblPad5 contentheadingblue"><div align="right"><strong>EITHER</strong></div></td>
                     <td width="79%" class="tblPad5"><label><input type="radio" name="gateway" value="PayPal" />
      Pay Pal (Visa, MC, PayPal a/c)</label></td>
                   </tr>
                   
                   <tr valign="middle">
                     <td align="right">&nbsp;</td>
                     <td>&nbsp;</td>
                   </tr>
                   <tr valign="middle">
                     <td class="tblPad5 contentheadingbluelarge"><div align="right"><strong>OR</strong></div></td>
                     <td class="tblPad5"><label><input type="radio" name="gateway" value="WorldPay" checked/>          WorldPay (Visa, MC, AMEX)</label></td>
                   </tr>
                   <tr valign="middle">
                     <td height="19">&nbsp;</td>
                     <td>&nbsp;</td>
                   </tr>
               </table>
<a href="#" onclick='contributeNow(this.form)'><img  src="../../../images/ContributeNow.jpg" name="lets-do-it" border="0" id="lets-do-it2" /></a></form>
Here is the Javascript:

Code: Select all

 
function contributeNow()    
{
    var joomlaid = "<?=$joomlaid?>";
    
    if (joomlaid == 0 ) {   
        alert('Please login before continuing. If you have not registered please register now for B1G1 BUSINESS');
    }
    else{
        var txtC;
        var textremdays = document.screen4form.selectMonth.value; 
        var validremdays = validremdays * 1;
 
        var PageName = "3"; 
 
            if( ( (document.screen4form.ContributionType[0].checked == true)  && (textremdays!="") && (textremdays!=0) ) || (document.screen4form.ContributionType[1].checked == true) ){
                if(document.screen4form.ContributionType[0].checked == true){
                        var txtR = document.screen4form.ContributionType[0].value;
                        var paramString = txtR;
                }else if(document.screen4form.ContributionType[1].checked == true){
                        var txtC = document.screen4form.ContributionType[1].value;
                        var paramString = txtC;
                }
                
                var paramString = paramString+"|"+textremdays+"|"+joomlaid;
                   
                                alert("paramString"+paramString);
                                alert("gateway "+document.screen4form.gateway);
// code where the error occurs
            [color=#BF0000]   if ((document.screen4form.gateway == "WorldPay") || (document.screen4form.gateway == "")){
                                alert("gateway "+WorldPay);
                    var urlstr="<?=$this_site_domain?>development/b1g1f/partnership/partnering_ContributionWP_set.php?paramString="+escape(paramString);
                    window.location=urlstr;
                }else if (document.screen4form.gateway == "PayPal"){
                                alert("gateway "+PayPal);
                    var urlstr="<?=$this_site_domain?>development/b1g1f/partnership/partnering_Contribution_PP_set.php?paramString="+escape(paramString);
                    window.location=urlstr;
                }               [/color]
            }
            else if( (document.screen4form.ContributionType[0].checked == false) && (document.screen4form.ContributionType[1].checked == false)){
                alert('Please select the type of contrubution!');
                document.screen4form.ContributionType[0].focus();
            }
            else if((textremdays==0) || (textremdays=="") || (isNaN(validremdays)) ){ 
            alert('Please Enter a valid reminder month and it must be numerical values');
            document.screen4form.selectMonth.focus();
        } 
 
       }
}
 
Can any one help me spot the bug? thanks guys

sokka
Post Reply