iEntry 10th Anniversary Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > JavaScript

Reply
 
LinkBack Thread Tools
Old March 16th, 2009, 11:22 AM   #1
New Member
 

Join Date: Mar 2009
Location: leeds
Age: 25
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 rugbyfitz is on a distinguished road
Javascript form Validation help!!

Hi There
I'm after some help, I am tyring to change some code (in the absence of the developer) which we already have in place on one of our web forms.
However i am having some issues., mainly because i am unfamiliar with javascript and would really appreciate some help
I would really appreciate some help in changing the code below to Hide the sales consultant field unless 'SME Business Sales Lead' has been selected from the lead type feild:
var leadType = "" // global variable to indicate if the Lead Type is "direct" or "indirect"
function checkSalesConsultant() { // if they choose an 'indirect' lead then disable the Sales Consultant drop-down
var q = document.frmDetails.leadType;
var x = q.selectedIndex;
if (q[q.selectedIndex].innerText.match(/indirect/i))
{
document.frmDetails('00N20000001YpHI').selectedInd ex=0
document.frmDetails('00N20000001YpHI').disabled=tr ue
leadType = "indirect"
}
else
{
document.frmDetails('00N20000001YpHI').disabled=fa lse
leadType = "direct"
}
}
Secondly would like to prevent the validation shown below from running should 'Mid Market Lead' be selected from the leadType field referenced above:
// mpan validation
var mpanError = false
var mpan = q('00N20000001Y1SD').value
if (mpan.length != 13) {mpanError = true}
if ( isNaN(mpan) ) {mpanError = true}
var multiplier = new Array (3, 5, 7, 13, 17, 19, 23, 29, 31, 37, 41, 43)
var total = 0
var i
var needMPAN = false
if ( q('00N20000001Yius')[1].checked || q('00N20000001Yius')[2].checked ) {needMPAN = true}
for (i=0; i<12; i++) {total += mpan.substr(i,1) * multiplier[i]}
if ( total % 11 % 10 != mpan.substr(12,1) ) {mpanError = true}
if ( mpan.match(/0{13}/) ) {mpanError = true}
if (needMPAN && mpanError) {
ErrorMessage += '- the MPAN is invalid\n';
q('00N20000001Y1SD').style.backgroundColor='salmon ' }
Thanks in advance, thats greatley appreciated!
rugbyfitz is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
JavaScript + validation stu2000 JavaScript 8 September 25th, 2008 08:11 AM
[SOLVED] javascript from validation eon201 JavaScript 2 October 24th, 2007 02:41 PM
javascript and xhtml validation nate2099 JavaScript 9 May 1st, 2007 07:34 PM
Form Validation cjrollo Flash and ActionScript 0 February 22nd, 2007 02:33 PM
PHP Email with Javascript validation Sabin_33 PHP 4 December 23rd, 2006 10:34 AM


Search Engine Optimization by vBSEO 3.2.0 RC8