Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Old 08-21-2007, 01:24 PM Code Expert Please
Novice Talker

Posts: 10
Trades: 0
Hi All, I posted this yesterday, but didn't get a responce, I apologise if I shouldn't have posted again, but I need to get this sorted asap

I was told you need to add javascript to make an options field in a paypal buy it now button mandatory, but I don't know how.
Currently if they don't select a colour that part comes to me blank, but I need it so they MUST select a colour.

Any help would be very much appreciated

This is that part of the code.


Dee



<INPUT type=hidden value="Colour " name=on0>
(**REQUIRED**) Please enter colour
</TD>
<TD>
<SELECT name=os0>
<OPTION value="none selected" selected>
Please select a colour
</OPTION>
<OPTION value="Black">
Black
</OPTION>
<OPTION value="Green">
Green
</OPTION>
</SELECT>
</TD>
</TR>
</TBODY>
</TABLE>
<BR>
<INPUT type=image alt="Make payments with PayPal - it's fast, free and secure!" src="https://www.paypal.com/images/x-click-but23.gif" border=0 name=submit3>

Last edited by Dee2007; 08-21-2007 at 01:26 PM..
Dee2007 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-21-2007, 08:29 PM Re: Code Expert Please
logic ali's Avatar
Super Talker

Posts: 104
Trades: 0
Inside the <form> tag insert:
Code:
onsubmit="return colourCheck(os0)"
In the <head> section insert:
Code:
<script type='text/javascript'>
function colourCheck(box)
{
 var rv=true;

 if(box.selectedIndex<1)
 {
  rv=false;
  alert("Please select a colour.");
 }
 return rv;
}
</script>
logic ali is offline
Reply With Quote
View Public Profile
 
Old 08-24-2007, 08:57 AM Re: Code Expert Please
Novice Talker

Posts: 10
Trades: 0
Hi Thanks loads for the reply.
I found a way to make the drop downs mandatory (while I wanted to see if i got a reply)

Using this code


<SCRIPT LANGUAGE="JavaScript">
function check_it(paypalform){
if(paypalform.os0.value == 'none selected'){
alert('Please Select A Colour');
return false;
}
return true;
}
</script>

<FORM action=https://www.paypal.com/cgi-bin/webscr method=post name="paypalform" onsubmit="return check_it(this);">




I have a second problem, I used the code above for the drop downs but I also need to make the input boxes mandatory, so I used this code.

<SCRIPT LANGUAGE="JavaScript">
function check_it(paypalform){
if(paypalform.os0.value == ''){
alert('Please enter a size');
return false;
}
return true;
}
</script>


<FORM action=https://www.paypal.com/cgi-bin/webscr method=post name="paypalform" onsubmit="return check_it(this);">
<INPUT type=hidden value=_xclick name=cmd>


While both codes work on there own, when they are both on the same page, the drop down code stops working, there must be a code conflict somewhere, but I haven't a clue where?

Any help again would be much appreciated.

Thanks
Dee

Last edited by Dee2007; 08-24-2007 at 09:06 AM..
Dee2007 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Code Expert Please
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.36421 seconds with 12 queries