Escolar Documentos
Profissional Documentos
Cultura Documentos
Login
Home
Forums
SearchForums
Wiki
Members
RecentPosts
Disallowthefirselementindropdownmenu
KietnaQuTak
New Member
Hello!InoneofformsmadeinFabrikv2.0b3I'musingdropdownelementwithseveraloptionstochose.Iwish
thiselementtoberequiredandhavefirst/defaultelementsomethinglike"Pleasechosesomething"anddisallow
tochoseit.Iwantusertochoseanythingelseexceptthisfirstoption,becauseitisonlylikealabelsaying"when
youclickhereyou'llseemoreoptionandyouneedtochosesomething".HowcanIdoavalidationpluginfor
suchelement?Iwastestingwithaddinglabletothefirst/defaultelement"blad"(whichmeans"error"inpolish
)andvalidationpluginwithfunction:
functionvalidate($wybor,&$element,$c)
{
if($wybor=='blad')returnfalse
elsereturntrue
}
Butitdoesn'tshowanyerrormessageifthefirstoptionfromdropdownwillbeselected.HowcanIsolvethis
issue(itdon'tneedtobedonewithvalidationplugin,mabythereissomebetterwaytodisallowselecting
first/defaultelementformdropdown).
Bestregards
KietnaQu'Tak
Dec11,2008
nunocordeiro
New Member
KietnaQuTaksaid:
Hello!InoneofformsmadeinFabrikv2.0b3I'musingdropdownelementwithseveraloptionstochose.Iwishthiselementtobe
http://fabrikar.com/forums/index.php?threads/disallow-the-firs-element-in-drop-down-menu.8788/
1/4
1/28/2016
requiredandhavefirst/defaultelementsomethinglike"Pleasechosesomething"anddisallowtochoseit.
Ididthisbyusingthevalidationbyregularexpression.
ThenIusedaregularexpressionthatmatchedeverythingexceptthevalueofthedefaultelement.
Forexample:thevaluesyouyoucanchoosegofrommondaytosunday
1.Youaddthe"Selectaday"optionandnamethecorrespondingvalue"default_selection"andsetitasdefault.
2.Addaregularexpressionmatchthatlookslikethis/^[^d]/(matchesanystringthatdoesn'tstartwitha'd'.
3.Setyouerrordesirederrormessageandshazzam...it'sworking!=)
Dec11,2008
KietnaQuTak
New Member
SimpleandWORKING!Nothingmoretosaythan:THANKSALOT:D
Dec11,2008
nunocordeiro
New Member
KietnaQuTaksaid:
SimpleandWORKING!Nothingmoretosaythan:THANKSALOT:D
You'remostwelcome=)
Don'tforgettoclosethethread.
Dec11,2008
skh
Member
Actually,thereisanewvalidationplugincalledisnotwhichisutilizedforsomethinglikeyourasking,theycan
pickanythinginthelistexceptwhatisset...suchaspleaseselect...
http://fabrikar.com/forums/index.php?threads/disallow-the-firs-element-in-drop-down-menu.8788/
2/4
1/28/2016
Thepluginisnotautomaticallyloadedbutyoucanseehowtoaddithere:
http://fabrikar.com/forums/showthread.php?p=45172#post45172
Cheers,
Keith
Dec12,2008
1personlikesthis.
cheesegrits
SupportGopher
StaffMember
Yup,that'sexactlywhyIaddedthe'isnot'validation...Terpfinallynaggedmeintoit.
hugh
Dec13,2008
1personlikesthis.
(Youmustloginorsignuptoreplyhere.)
ShareThisPage
Tw eet
Login
UsefulLinks
CreateaFabrikAccount
FabrikWiki
Fabrikongithub
MembersOnlineNow
Total:50(members:0,guests:37,robots:13)
3.1GithubCommits
http://fabrikar.com/forums/index.php?threads/disallow-the-firs-element-in-drop-down-menu.8788/
3/4