Forum Four51° Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Advanced Script: Using same variable specs twice

 
Post new topic   Reply to topic    Forum Four51° Forum Index -> Pageflex (L3 - L4)
View previous topic :: View next topic  
Author Message
mvang



Joined: 29 Jan 2008
Posts: 80

PostPosted: Wed Nov 04, 2009 10:48 am    Post subject: Advanced Script: Using same variable specs twice Reply with quote

Can we use the same variable specs twice on two different functions.

For example:
var ccpath = 'http://www.four51.com/Themes/Custom/fad32.../DocumentActions/FrandsenFinancialInvestment/image_library/';
var logoList = spec['LogoChoice'];
logoList.imageSelector(
{
effect : 'fadeIn', bordercolor : "red", width : 500, height : 120, thumbnailsize : 90, bgcolor : "#fff", bordercolor : "#000", highlightcolor : "#ff0", debug : true, rollovertext : "Click this to enlarge logo",
images : [
ccpath + 'FBT.jpg',
ccpath + 'QCFB.jpg',
ccpath + 'RAB.jpg',
ccpath + 'VB.jpg' ]
}
);

var branchList = spec['BranchLocation'];
function refreshBranches()
{
branchList.hideAllOptions();
branchList.showOptionAt(0);
var logo = logoList.selectedText();
switch (logo)
{
case 'FBT.jpg' :
branchList.showOptionRange('Frandsen Bank and Trust - Ada', 'Frandsen Bank and Trust - Warren');
break;
case 'QCFB.jpg' :
branchList.showOptionRange('Queen City Federal - Carlton', 'Queen City Federal - Virginia');
break;
case 'RAB.jpg' :
branchList.showOptionRange('Rural American Bank - Braham/Pine City', 'Rural American Bank - Luck/Dresser');
break;
case 'VB.jpg' :
branchList.showOptionRange('Valley Bank - Fairfax', 'Valley Bank - Waterville');
break;

}
}
Back to top
View user's profile Send private message
Steve



Joined: 17 Jan 2008
Posts: 337

PostPosted: Thu Nov 05, 2009 10:29 am    Post subject: Re: Advanced Script: Using same variable specs twice Reply with quote

mvang wrote:
Can we use the same variable specs twice on two different functions.
}


Yes
_________________
Steve

You can read about other advanced tech topics on the http://www.insightsfour51.com/?cat=3
Back to top
View user's profile Send private message
mvang



Joined: 29 Jan 2008
Posts: 80

PostPosted: Thu Nov 05, 2009 10:54 am    Post subject: Reply with quote

Great!
So....my second function is not working.
Could it be...because the script below is referring to the logo file name?

var branchList = spec['BranchLocation'];
function refreshBranches()
{
branchList.hideAllOptions();
branchList.showOptionAt(0);

logoList.selectedText();
switch (logoList)
{
case 'FBT.jpg' :
branchList.showOptionRange('Frandsen Bank and Trust - Ada', 'Frandsen Bank and Trust - Warren');
break;
case 'QCFB.jpg' :
branchList.showOptionRange('Queen City Federal - Carlton', 'Queen City Federal - Virginia');
break;
case 'RAB.jpg' :
branchList.showOptionRange('Rural American Bank - Braham/Pine City', 'Rural American Bank - Luck/Dresser');
break;
case 'VB.jpg' :
branchList.showOptionRange('Valley Bank - Fairfax', 'Valley Bank - Waterville');
break;

}
}
Back to top
View user's profile Send private message
Steve



Joined: 17 Jan 2008
Posts: 337

PostPosted: Thu Nov 05, 2009 11:09 am    Post subject: Reply with quote

The image selector widget is not a dropdown. Accessing the selected value is documented in the wiki:

http://www.insightsfour51.com/wiki/index.php/Image_Selector

Code:
spec['Image'].imageSelector.value()


or

Code:
logoList.imageSelector.value()

_________________
Steve

You can read about other advanced tech topics on the http://www.insightsfour51.com/?cat=3
Back to top
View user's profile Send private message
mvang



Joined: 29 Jan 2008
Posts: 80

PostPosted: Thu Nov 05, 2009 11:31 am    Post subject: Reply with quote

I don't quite understand.

My goal is if select "FBT.jpg" logo than we want to only show FBT branch locations where my script indicate: case 'FBT.jpg' : branchList.showOptionRange('Frandsen Bank and Trust - Ada', 'Frandsen Bank and Trust - Warren');

Currently right now it's showing all.
Any help is greatly appreciated. Thank You.
MV
Back to top
View user's profile Send private message
Steve



Joined: 17 Jan 2008
Posts: 337

PostPosted: Thu Nov 05, 2009 11:36 am    Post subject: Reply with quote

ImageSelector is not a DropDownList. You can't treat it like that. The functions you are using are for DropDownLists.
_________________
Steve

You can read about other advanced tech topics on the http://www.insightsfour51.com/?cat=3
Back to top
View user's profile Send private message
mvang



Joined: 29 Jan 2008
Posts: 80

PostPosted: Thu Nov 05, 2009 12:11 pm    Post subject: Reply with quote

Ok. so looks like the imageselector idea doesn't work.
so if i go back to my old forum and use the dropdown logo options with thumbnail images i still have the issue when selecting the logo on the drop down it's not grabbing the right images. so instead my first function is not working and my second one is.
for example if i select the Valley Bank logo my branch locations only shows the Valley bank locations but it does not show the correct logo which should be VB.jpg instead it shows FBT.jpg.
But after i render the proof than the correct logo show.

Advanced Scriptvar preview = get('preview');
var logoList = spec['LogoChoice'];
var path = "http://www.four51.com/Themes/Custom/fad32e83-e533-45aa-a524-84ab6f5e08f9/DocumentActions/FrandsenFinancialInvestment/image_library/";
var images =
{
"Frandsen Bank and Trust" : "FBT.jpg",
"Queen City Federal Bank" : "QCFB.jpg",
"Rural American Bank" : "RAB.jpg",
"Valley Bank" : "VB.jpg"
}
function Display()
{
preview.imgSrc(path + images[logoList.selectedText()]);
}
logoList.onchange = Display;
logoList.removeOption(0);
spec ['Logos'].hide();
Display();

var branchList = spec['BranchLocation'];
function refreshBranches()
{
branchList.hideAllOptions();
branchList.showOptionAt(0);

var logo = logoList.selectedText();
switch (logo)
{
case 'Frandsen Bank and Trust' :
branchList.showOptionRange('Frandsen Bank and Trust - Ada', 'Frandsen Bank and Trust - Warren');
break;
case 'Queen City Federal Bank' :
branchList.showOptionRange('Queen City Federal - Carlton', 'Queen City Federal - Virginia');
break;
case 'Rural American Bank' :
branchList.showOptionRange('Rural American Bank - Braham/Pine City', 'Rural American Bank - Luck/Dresser');
break;
case 'Valley Bank' :
branchList.showOptionRange('Valley Bank - Fairfax', 'Valley Bank - Waterville');
break;

}
}
logoList.onchange = refreshBranches;
refreshBranches();

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Forum Four51° Forum Index -> Pageflex (L3 - L4) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group