Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-02-2011, 04:35 PM   PM User | #31
newbie14
New Coder

 
Join Date: May 2011
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
newbie14 is an unknown quantity at this point
Dear SB65,
The datepicker is ok working well showing at the right location under input box. The thing why I stick to this tab still is because I have done a lot of pages of coding already so I have to do a lot of rework. On top of that also because of its style. I have done the coding in the validation to show the right tab but is not highlighting the the right tab. But from the php code representing the tabs as below it highlight the right tab but from my javascript validateForm it does not highlight the right tab. This is my only problem I am lost because the same function work well when called from php but not from another javascript function.

Code:
$kts->addTab("root","Driver Details","Driver Details","javascript:showTab(\"driverDetails\")",$driverDetails);
		$kts->addTab("root","Driver Licenses","Driver Licenses","javascript:showTab(\"driverLicenses\")",$driverLicenses);
		$kts->addTab("root","Driver Employment","Driver Employment","javascript:showTab(\"driverEmployment\")",$driverEmployment);
newbie14 is offline   Reply With Quote
Old 05-02-2011, 04:43 PM   PM User | #32
SB65
Senior Coder

 
Join Date: Feb 2009
Location: West Yorkshire
Posts: 2,812
Thanks: 9
Thanked 681 Times in 675 Posts
SB65 will become famous soon enoughSB65 will become famous soon enough
Datepicker is not under the input box in FF, however, fair enough.
The problem is with your validation code I think - the conditions to switch the tabs in your javascript are not met.
SB65 is offline   Reply With Quote
Old 05-02-2011, 04:48 PM   PM User | #33
newbie14
New Coder

 
Join Date: May 2011
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
newbie14 is an unknown quantity at this point
Dear SB65,
Yes thank you I saw it in FF is not appearing well but why in IE is ok. What could be the cause ya? What else do you think I should include in my validation code to enable the switching to happen. I dont understand why the showTab function works well when call from the php but not from validateForm function? Quite weird right?
newbie14 is offline   Reply With Quote
Old 05-02-2011, 05:00 PM   PM User | #34
SB65
Senior Coder

 
Join Date: Feb 2009
Location: West Yorkshire
Posts: 2,812
Thanks: 9
Thanked 681 Times in 675 Posts
SB65 will become famous soon enoughSB65 will become famous soon enough
Quote:
What could be the cause ya?
I'd suggest validating your code and adding a valid doctype. IE may be displaying what you want but it isn't displaying correctly.

Quote:
I dont understand why the showTab function works well when call from the php but not from validateForm function? Quite weird right?
Not necessarily. The showTab I'm sure works fine, but the conditions required in your javascript to call showTab are not met - so I think the problem is in your validation javascript. This no doubt isn't the same as your php validation script, so it's not especially weird it does something different.
SB65 is offline   Reply With Quote
Old 05-02-2011, 05:10 PM   PM User | #35
newbie14
New Coder

 
Join Date: May 2011
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
newbie14 is an unknown quantity at this point
Dear SB65,
I agree the danger with IE so when you say validate my code what is the procedure you mean post to the w3c site ? For the Doctype I have added this right at the top as below. Do you that is fine or shall I add it some where below?

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php 
session_start();
So the problem in the showTab when called from javascript is that this part is not working. Any idea how to make it work from javascript calling itself?

Code:
<?php 		 
    $driverDetails='';
    $driverLicenses=true;
    $driverEmployment='';
?>
newbie14 is offline   Reply With Quote
Old 05-02-2011, 05:17 PM   PM User | #36
SB65
Senior Coder

 
Join Date: Feb 2009
Location: West Yorkshire
Posts: 2,812
Thanks: 9
Thanked 681 Times in 675 Posts
SB65 will become famous soon enoughSB65 will become famous soon enough
Doctype should be right at the top, yes. And yes, use the w3c site to validate. The biggest issue for IE is the lack of a doctype.

Re validation, the problem is that the conditions within your validateForm javascript function which cause showTabs to fire are not met - that's where you need to look.
SB65 is offline   Reply With Quote
Old 05-02-2011, 05:37 PM   PM User | #37
newbie14
New Coder

 
Join Date: May 2011
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
newbie14 is an unknown quantity at this point
Dear SB65,
Actually by including the doctype what it does to your web page? What effect it will bring?

RE validation. For instance below all the show and hide of the elements works well because it shows the right content. Thus only the php part below is not working.

Code:
else if(tabID=="driverLicenses")
	{
		//alert("DD : "+tabID);
		document.getElementById("driverDetails").className = "hide"; 
		document.getElementById("driverLicenses").className = "show";
		document.getElementById("driverEmployment").className = "hide";
		<?php 		 
    $driverDetails='';
    $driverLicenses=true;
		$driverEmployment='';
		
		?>
	}
newbie14 is offline   Reply With Quote
Old 05-02-2011, 05:56 PM   PM User | #38
SB65
Senior Coder

 
Join Date: Feb 2009
Location: West Yorkshire
Posts: 2,812
Thanks: 9
Thanked 681 Times in 675 Posts
SB65 will become famous soon enoughSB65 will become famous soon enough
Have a look here for info about doctypes.
You need a valid doctype to make IE behave.

Quote:
...Thus only the php part below is not working.
What? No, it is the javascript validateForm function that's the problem.
SB65 is offline   Reply With Quote
Old 05-02-2011, 06:01 PM   PM User | #39
newbie14
New Coder

 
Join Date: May 2011
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
newbie14 is an unknown quantity at this point
Dear SB65,
If the validateForm have the problem it can not call the showTab function. But in my case I am very sure it is calling the showTab function because I have tested it with the alerts.
newbie14 is offline   Reply With Quote
Old 05-02-2011, 06:11 PM   PM User | #40
SB65
Senior Coder

 
Join Date: Feb 2009
Location: West Yorkshire
Posts: 2,812
Thanks: 9
Thanked 681 Times in 675 Posts
SB65 will become famous soon enoughSB65 will become famous soon enough
OK, I've no intention of arguing with you.
SB65 is offline   Reply With Quote
Old 05-02-2011, 06:29 PM   PM User | #41
newbie14
New Coder

 
Join Date: May 2011
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
newbie14 is an unknown quantity at this point
Dear SB65,
Come on we are not to learn not argue hehe how can I argue with you when you have helped me so much ok no way. I am just confirming sorry incase you felt me arguing ya. No argue all is to learn.
newbie14 is offline   Reply With Quote
Old 05-02-2011, 07:08 PM   PM User | #42
SB65
Senior Coder

 
Join Date: Feb 2009
Location: West Yorkshire
Posts: 2,812
Thanks: 9
Thanked 681 Times in 675 Posts
SB65 will become famous soon enoughSB65 will become famous soon enough
I've misunderstood your problem. What you're saying is that the tab is changing correctly, but that the tab heading is not changed to match.

However it is changed when clicked - so here the javascript is fine, but when called from the validate it isn't.

Can't immediately see why that is...

In fact, the showTab function does nothing to the tab heading, so to an extent that's expected. Is there something else driven by the click event on the tab I wonder.

Last edited by SB65; 05-02-2011 at 07:16 PM..
SB65 is offline   Reply With Quote
Old 05-02-2011, 08:12 PM   PM User | #43
newbie14
New Coder

 
Join Date: May 2011
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
newbie14 is an unknown quantity at this point
Dear SB65,
At last you saw my problem. This is what eating my thoughts what else could be wrong. Why when I press the tab is ok but not from the java script function? I am also figuring it out incase you can see please let me know.
newbie14 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 01:01 PM.


Advertisement
Log in to turn off these ads.