Você está na página 1de 6

1/28/2016

How to use 2 or more cascadingdropdown elements in a chain! | Fabrik

Login

Home

Forums

SearchForums

Wiki

Members

RecentPosts

Home Forums Fabrik2.x FrequentlyAnsweredQuestions

Howtouse2ormorecascadingdropdownelementsinachain!
Francesco
New Member

Hipeople,using2ormorecascadingdropdownelementsinachain.
Let'sconsider3elementsinagroup,forexample:
country>state>city
Wecandoitwithadatabasejoinelementforcountry,acascadingdropdownelement(watchingthecountry
element)forstateandacascadingdropdownelement(watchingthestateelement)forthecity.Sowehave:
databasejoin>cascadingdropdown1>cascadingdropdown2
Itworksfine,butafteryourselections,ifyouchangethevalueindatabasejoinelement,thenonly
cascadingdropdown1refreshesandnotcascadingdropdown2thatshouldcontainonlytwovalues:"Pleaseselect"
and''(emptystring),thelastoneselected.
Ifyouwanttodoit,justputthefollowingjavascriptcodeonthe'change'eventinthedatabasejoinelement:
objselect=$('elementid')
nopts=objselect.options.length
for(i=2i<noptsi++){objselect.options[2]=null}
if(nopts>1){objselect.options[1].text=''objselect.selectedIndex=1}
whereelementidistheHTMLidofthecascadingdropdown2element.
IfyouareusingaSearchForm,andyourelementiscalledcity,thenelementid=___city
Ifyouareinaformview,andyourelementiscalledcity,thenelementid=tablename___city
Ifyoudon'tknowtherightvalueforelementid,youcanlookattheHTMLsourcecodeofyourwebpage!
Thiscoderemovealloptionsinadropdownfield,butthefirst2,inthiscasetheyare:"Pleaseselect"and''(an
emptystring),thelastoneselected.
http://fabrikar.com/forums/index.php?threads/how-to-use-2-or-more-cascadingdropdown-elements-in-a-chain.8894/

1/7

1/28/2016

How to use 2 or more cascadingdropdown elements in a chain! | Fabrik

Youcanchangethiscodeforyourparticularapplication.
ForRoband/orHugh:thisthreadshouldbemovedintheFAQssection!
Dec18,2008
4peoplelikethis.

rob
Administrator
StaffMember

moved,thxFrancesco!
Rob

Dec18,2008

buhrowmj
New Member

Conditionaldropdownsfullinstructionsne e de d
Ihavereadthroughthe8pagesofrepliestothecascadingdropdownsinFabrik1.0.Iamsuspectingthatthereis
moretogettingthecascadingdropdownstoworkinFabrik2thanjustthecodeabove.Iamhopingtofindastep
bystepinstructiononhowtogetthebasicCountry/TowndropdownsceneriotoworkforIE7andFabrik2.
Jan9,2009

cheesegrits
SupportGopher
StaffMember

Well,2.0doesmakeitatoneasier...there'snocustomJSorAJAXcode.Youjustcreateyourfirstdropdown
(Country)asanormaldatabasejoin.Thenaddacascadingdropdownelement(Town)to"watch"it.
Thereareseveralpostsinthe2.0forumswhichexplainwhatthevariousoptionsonthecascadingdropdown
configpagearefor.Justsearchwithsomelikelykeywordsandyoushouldbeabletofind'em.
hugh
Jan9,2009
http://fabrikar.com/forums/index.php?threads/how-to-use-2-or-more-cascadingdropdown-elements-in-a-chain.8894/

2/7

1/28/2016

How to use 2 or more cascadingdropdown elements in a chain! | Fabrik

buhrowmj
New Member

Foundthe pluginandinstalle d
Thanks.Foundthepluginandisworkinggreat.

Jan14,2009

cypherinfo
Member

Francescosaid:

Hipeople,using2ormorecascadingdropdownelementsinachain.
Let'sconsider3elementsinagroup,forexample:
country>state>city
Wecandoitwithadatabasejoinelementforcountry,acascadingdropdownelement(watchingthecountryelement)forstateanda
cascadingdropdownelement(watchingthestateelement)forthecity.Sowehave:
databasejoin>cascadingdropdown1>cascadingdropdown2
Clicktoexpand...

Hello,

ciaosonoItalianoancheio.
ToletotherusersfollowingourconversationIprefertowriteinenglish.
IhavereadyourthreadandIwonderifyouaretalkingaboutonetableonlywhenyouwriteaboutadatabase
joinifnothowtodothesamewithonetableonly?

thankyou.

Cypherinfo
Aug4,2009

http://fabrikar.com/forums/index.php?threads/how-to-use-2-or-more-cascadingdropdown-elements-in-a-chain.8894/

3/7

1/28/2016

How to use 2 or more cascadingdropdown elements in a chain! | Fabrik

sybn
New Member

mytableiscalledistek_formu
myelements
sehir>ilce>mahalle
databasejoin>cascadingdropdown1>cascadingdropdown2
andIinsertedthejavascriptcode,inthesehir,databasejointelementlikethis:

PHP:

objselect=$('istek_formu___mahalle')
nopts=objselect.options.length
for(i=2i<noptsi++){objselect.options[2]=null}
if(nopts>1){objselect.options[1].text=''objselect.selectedIndex=1}

isitright?

Sep14,2009

chris.bernard@dock29.com
New Member

Mycascading1isn'te ve nworking
Ihavechangedthewatcheditems.MustIhavesomethingintheWherequery?Ihaveonetablethathas
locationinformation.State,City,AddressandIhaveadropdownwherethedatabasejoinissettostate,but
whenusersselectthestatenothinghappenstotheCity,orAddresscascadingdropdowns,theycontinuetosay
"PleaseSelect"thenhaveablankrecordbelowit.Anyhelpwouldbegreatlyappreciated.
Mar16,2010

cheesegrits
SupportGopher
StaffMember

http://fabrikar.com/forums/index.php?threads/how-to-use-2-or-more-cascadingdropdown-elements-in-a-chain.8894/

4/7

1/28/2016

How to use 2 or more cascadingdropdown elements in a chain! | Fabrik

CanyoustartathreadintheregularBronzesupportforum,andpostscreenshotsofyourelementssettingsfor
eachelement?
hugh

Mar17,2010

amayajairo
New Member

Errorincascadingdropdowne le me nt2.0
Pleasehelpmeinthiserror,iamnotanexpert==access:
http://recursosdegerencia.com/mv/administrator
user:admin
password:demo
Iyousee'mv_funcionarios'tableinfabrik,appearserror.
Whenyouaddrecordsoperateswell.Thecascadedropdownelementplugin2.0generateserror.Dontappears
thetableviewrecords.
Pleasehelpme
Thanks

Francescosaid:

Hipeople,using2ormorecascadingdropdownelementsinachain.
Let'sconsider3elementsinagroup,forexample:
country>state>city
Wecandoitwithadatabasejoinelementforcountry,acascadingdropdownelement(watchingthecountryelement)forstateanda
cascadingdropdownelement(watchingthestateelement)forthecity.Sowehave:
databasejoin>cascadingdropdown1>cascadingdropdown2
Clicktoexpand...

Nov14,2010

http://fabrikar.com/forums/index.php?threads/how-to-use-2-or-more-cascadingdropdown-elements-in-a-chain.8894/

5/7

1/28/2016

How to use 2 or more cascadingdropdown elements in a chain! | Fabrik

amayajairo
New Member

Errorincascadingdropdowne le me nt2.0
Pleaseaccess:
http://recursosdegerencia.com/mv/administrator
user:admin
password:demo
Iyousee'mv_funcionarios'tableinfabrik,appearserror.
Whenyouaddrecordsoperateswell.Thecascadedropdownelementplugin2.0generateserror.Dontappears
thetableviewrecords.
Pleasehelpme
Thanks
Nov14,2010

raunhar
Member

Iwasbaletocreatethestatecitydropdownafterreadingyourtutorial.
Iwanttohavethefollowingtypeofdropdown:
State(databasejoin)city(cdd)Schoollocation(cdd2).
CanItakethecdd2fromsobiprodatabase,ORifpossiblecanItakebothcdd1andcdd2fromtheSobipro
database.
Jan19,2015
(Youmustloginorsignuptoreplyhere.)

ShareThisPage
Tw eet

Recom m end Bethefirstofyourfriendstorecommendthis.

Login
UsefulLinks
CreateaFabrikAccount
http://fabrikar.com/forums/index.php?threads/how-to-use-2-or-more-cascadingdropdown-elements-in-a-chain.8894/

6/7