Module:FormCheckAndSubmit: Difference between revisions
From Tsadra Foundation Advanced Contemplative Scholarships
(by SublimeText.Mediawiker) |
(by SublimeText.Mediawiker) |
||
| (16 intermediate revisions by the same user not shown) | |||
| Line 6: | Line 6: | ||
local requiredFields = { | local requiredFields = { | ||
pargs.firstname , | |||
pargs.lastname , | |||
pargs.birthdate , | |||
pargs.birthcountry , | |||
pargs.nationality , | |||
pargs.street , | |||
pargs.city , | |||
pargs.postalcode , | |||
pargs.country , | |||
pargs.email , | |||
pargs.telephone , | |||
pargs.retreattype , | |||
pargs['cv-edu'] , | |||
pargs['cv-work'] , | |||
pargs.studiedtibetan , | |||
pargs.spokentibcomprehension , | |||
pargs.writtentibcomprehension , | |||
pargs.tibetanrequiredforretreat , | |||
pargs.tibetanretreatparts , | |||
pargs.introbuddhism , | |||
pargs.refugehistory , | |||
pargs.formalvows , | |||
pargs.ngondrocomplete , | |||
pargs.previousretreatscomplete , | |||
pargs.ynadvstudiesprogs , | |||
pargs.ynofferedservices , | |||
pargs.othercommunitywork , | |||
pargs.retreatduration , | |||
pargs.StartFunding , | |||
pargs.EndFunding , | |||
pargs.costestimateCurrency , | |||
pargs.costestimate , | |||
pargs.requestedamountCurrency , | |||
pargs.requestedamount , | |||
pargs.othermoney , | |||
pargs.letterofmotivation , | |||
pargs.FileHaveCV , | |||
pargs.FileHaveDharmaCV , | |||
pargs.FileHavePhoto , | |||
pargs.FileHaveDescriptFinSit , | |||
pargs.recom1NameFirst , | |||
pargs.recom1NameLast , | |||
pargs.recom1Email , | |||
pargs.recom1Relate , | |||
pargs.recom2NameFirst , | |||
pargs.recom2NameLast , | |||
pargs.recom2Email , | |||
pargs.recom2Relate | |||
} | } | ||
local threeYearFields = { | local threeYearFields = { | ||
pargs.center , | |||
pargs.centerstreet , | |||
pargs.centercity , | |||
pargs.centerpostalcode , | |||
pargs.centercountry , | |||
pargs.startdate , | |||
pargs.enddate , | |||
pargs.retreatmaster , | |||
pargs.retreatadministrator , | |||
pargs.retreatadministratoremail , | |||
pargs.retreatliaison , | |||
pargs.retreatliaisonemail , | |||
pargs.FileHaveAcceptLetter , | |||
pargs.AcceptLetterAuthorFirst , | |||
pargs.AcceptLetterAuthorLast , | |||
pargs.AcceptLetterEmail , | |||
pargs.AcceptLetterPhone , | |||
pargs.FileHaveRetreatBudgCost , | |||
pargs.CostLetterAuthorFirst , | |||
pargs.CostLetterAuthorLast , | |||
pargs.CostLetterEmail , | |||
pargs.CostLetterPhone , | |||
pargs.FileHaveEligibilityDocs | |||
} | } | ||
local solitaryFields = { | local solitaryFields = { | ||
pargs.solcenterstreet , | |||
pargs.solcentercity , | |||
pargs.solcenterpostalcode , | |||
pargs.solcentercountry , | |||
pargs.solstartdate , | |||
pargs.solenddate , | |||
pargs.solretreatliaison , | |||
pargs.solretreatliaisonemail , | |||
pargs.SolHermDescription , | |||
pargs.FileHaveSolHermDescript , | |||
pargs.FileHaveSolRetreatProg , | |||
pargs.FileHaveSolRetreatBudg | |||
} | } | ||
local saveInput = mw.html.create( 'input' ) | |||
saveInput | |||
:attr( 'id', 'TfacsSubmitApplication' ) | |||
:attr( 'type', 'submit' ) | |||
:attr( 'value', 'Save your application' ) | |||
:attr( 'class', 'btn btn-primary' ) | |||
local saveButton = tostring( saveInput ) | |||
local submitInput = mw.html.create( 'input' ) | |||
submitInput | |||
:attr( 'id', 'TfacsSubmitApplication' ) | |||
:attr( 'type', 'submit' ) | |||
:attr( 'value', 'Submit your final application!' ) | |||
:attr( 'class', 'btn btn-danger' ) | |||
local submitButton = tostring( submitInput ) | |||
if not pargs.retreattype or pargs.retreattype == "" then | |||
return "Retreat type not selected." | |||
for | elseif pargs.retreattype == "Three-year retreat" then | ||
return | for key, value in ipairs( threeYearFields ) do | ||
table.insert( requiredFields , key , value ) | |||
end | |||
if #requiredFields == 71 then | |||
return "All 71 fields for 3 year filled. All done!" | |||
else | |||
return "71 required fields for 3 year not filled. Not done." | |||
end | |||
elseif pargs.retreattype == "Solitary hermitage" then | |||
for key, value in ipairs( solitaryFields ) do | |||
table.insert( requiredFields , key , value ) | |||
end | |||
if #requiredFields == 60 then | |||
return "All 60 fields for solitary filled. All done!" | |||
else | |||
return "60 required fields for solitary not filled. Not done." | |||
end | |||
end | end | ||
end | end | ||
return p | return p | ||
Latest revision as of 06:20, 20 May 2024
Documentation for this module may be created at Module:FormCheckAndSubmit/doc
local p = {}
function p.main(frame)
local pargs = frame:getParent().args
local requiredFields = {
pargs.firstname ,
pargs.lastname ,
pargs.birthdate ,
pargs.birthcountry ,
pargs.nationality ,
pargs.street ,
pargs.city ,
pargs.postalcode ,
pargs.country ,
pargs.email ,
pargs.telephone ,
pargs.retreattype ,
pargs['cv-edu'] ,
pargs['cv-work'] ,
pargs.studiedtibetan ,
pargs.spokentibcomprehension ,
pargs.writtentibcomprehension ,
pargs.tibetanrequiredforretreat ,
pargs.tibetanretreatparts ,
pargs.introbuddhism ,
pargs.refugehistory ,
pargs.formalvows ,
pargs.ngondrocomplete ,
pargs.previousretreatscomplete ,
pargs.ynadvstudiesprogs ,
pargs.ynofferedservices ,
pargs.othercommunitywork ,
pargs.retreatduration ,
pargs.StartFunding ,
pargs.EndFunding ,
pargs.costestimateCurrency ,
pargs.costestimate ,
pargs.requestedamountCurrency ,
pargs.requestedamount ,
pargs.othermoney ,
pargs.letterofmotivation ,
pargs.FileHaveCV ,
pargs.FileHaveDharmaCV ,
pargs.FileHavePhoto ,
pargs.FileHaveDescriptFinSit ,
pargs.recom1NameFirst ,
pargs.recom1NameLast ,
pargs.recom1Email ,
pargs.recom1Relate ,
pargs.recom2NameFirst ,
pargs.recom2NameLast ,
pargs.recom2Email ,
pargs.recom2Relate
}
local threeYearFields = {
pargs.center ,
pargs.centerstreet ,
pargs.centercity ,
pargs.centerpostalcode ,
pargs.centercountry ,
pargs.startdate ,
pargs.enddate ,
pargs.retreatmaster ,
pargs.retreatadministrator ,
pargs.retreatadministratoremail ,
pargs.retreatliaison ,
pargs.retreatliaisonemail ,
pargs.FileHaveAcceptLetter ,
pargs.AcceptLetterAuthorFirst ,
pargs.AcceptLetterAuthorLast ,
pargs.AcceptLetterEmail ,
pargs.AcceptLetterPhone ,
pargs.FileHaveRetreatBudgCost ,
pargs.CostLetterAuthorFirst ,
pargs.CostLetterAuthorLast ,
pargs.CostLetterEmail ,
pargs.CostLetterPhone ,
pargs.FileHaveEligibilityDocs
}
local solitaryFields = {
pargs.solcenterstreet ,
pargs.solcentercity ,
pargs.solcenterpostalcode ,
pargs.solcentercountry ,
pargs.solstartdate ,
pargs.solenddate ,
pargs.solretreatliaison ,
pargs.solretreatliaisonemail ,
pargs.SolHermDescription ,
pargs.FileHaveSolHermDescript ,
pargs.FileHaveSolRetreatProg ,
pargs.FileHaveSolRetreatBudg
}
local saveInput = mw.html.create( 'input' )
saveInput
:attr( 'id', 'TfacsSubmitApplication' )
:attr( 'type', 'submit' )
:attr( 'value', 'Save your application' )
:attr( 'class', 'btn btn-primary' )
local saveButton = tostring( saveInput )
local submitInput = mw.html.create( 'input' )
submitInput
:attr( 'id', 'TfacsSubmitApplication' )
:attr( 'type', 'submit' )
:attr( 'value', 'Submit your final application!' )
:attr( 'class', 'btn btn-danger' )
local submitButton = tostring( submitInput )
if not pargs.retreattype or pargs.retreattype == "" then
return "Retreat type not selected."
elseif pargs.retreattype == "Three-year retreat" then
for key, value in ipairs( threeYearFields ) do
table.insert( requiredFields , key , value )
end
if #requiredFields == 71 then
return "All 71 fields for 3 year filled. All done!"
else
return "71 required fields for 3 year not filled. Not done."
end
elseif pargs.retreattype == "Solitary hermitage" then
for key, value in ipairs( solitaryFields ) do
table.insert( requiredFields , key , value )
end
if #requiredFields == 60 then
return "All 60 fields for solitary filled. All done!"
else
return "60 required fields for solitary not filled. Not done."
end
end
end
return p