Commit 82065d47 authored by Rinus Plasmeijer's avatar Rinus Plasmeijer
Browse files

coded name of form to enable any character in a name

parent 736d2a6f
......@@ -30,6 +30,7 @@ import htmlFormData
| UpdS String // new piece of text
encodeTriplet :: !Triplet -> String // encoding of triplets
encodeString :: !String -> String // encoding of
// Form submission handling
......
......@@ -7,23 +7,25 @@ derive gUpd []
//Start world = doHtmlServer (multiUser (Quotation myQuotation)) world
//Start world = doHtmlServer (multiUser twotasks3) world
Start world = doHtmlServer (multiUser agenda2) world
Start world = doHtmlServer (multiUser twotasks3) world
where
singleUser tasks hst
# (_,html,hst) = startTask 0 tasks hst
= mkHtml "test" html hst
= mkHtml "stest" html hst
multiUser tasks hst
# (idform,hst) = FuncMenu (Init,nFormId "pdm_chooseWorker"
(0,[("User " +++ toString i,\_ -> i) \\ i<-[0..5] ])) hst
# currentWorker = snd idform.value
# (_,html,hst) = startTask currentWorker (persistent tasks) hst
= mkHtml "test" [idform.form <=> html] hst
= mkHtml "mtest" [idform.form <=> html] hst
where
persistent tasks tst
// # tst = setTaskAttribute Persistent tst
# tst = setTaskAttribute StaticDynamic tst
# tst = setTaskAttribute Database tst
# tst = setTaskAttribute Persistent tst
// # tst = setTaskAttribute StaticDynamic tst
// # tst = setTaskAttribute Database tst
= tasks tst
......
......@@ -157,7 +157,8 @@ vertlistForm :: !(InIDataId [a]) !*HSt -> (Form [a],!*HSt) | iData a
vertlistForm inIDataId hSt = layoutListForm (\f1 f2 -> [f1 <||> f2]) mkEditForm inIDataId hSt
vertlistFormButs :: !Int !Bool !(InIDataId [a]) !*HSt -> (Form [a],!*HSt) | iData a
vertlistFormButs nbuts showbuts (init,formid) hst
vertlistFormButs nbuts showbuts (init,formid=:{mode}) hst
# formid = formid <@ Edit
# indexId = subFormId formid "idx" 0 <@ Display
# (index,hst) = mkEditForm (init,indexId) hst
# (olist,hst) = listForm (init,formid) hst
......@@ -197,7 +198,7 @@ vertlistFormButs nbuts showbuts (init,formid) hst
# newlist = app.value newlist
# newlist = del.value newlist
# (list, hst) = listForm (setID formid newlist) hst
# (list, hst) = listForm (Set,setFormId formid newlist <@ mode) hst
# lengthlist = length newlist
# (index,hst) = mkEditForm (setID indexId obbuts.value) hst
# (bbuts,hst) = browseButtons (Init, bbutsId) step lengthlist nbuts hst
......@@ -210,7 +211,10 @@ vertlistFormButs nbuts showbuts (init,formid) hst
= ( { form = pdbuts.form ++ bbuts.form ++
[[ toHtml ("nr " <+++ (i+1) <+++ " / " <+++ length list.value)
<.||.>
(onMode formid.mode (if showbuts (del <.=.> ins <.=.> app <.=.> copy <.=.> paste) EmptyBody) EmptyBody EmptyBody EmptyBody)
(onMode formid.mode (if showbuts (del <.=.> ins <.=.> app <.=.> copy <.=.> paste) EmptyBody)
(if showbuts (del <.=.> ins <.=.> app <.=.> copy <.=.> paste) EmptyBody)
EmptyBody
EmptyBody)
\\ del <- del.form & ins <- ins.form & app <- app.form & copy <- copy.form & paste <- paste.form & i <- [bbuts.value..]]
<=|>
list.form % betweenindex
......@@ -288,7 +292,7 @@ listForm inIDataId hSt = layoutListForm (\f1 f2 -> [BodyTag f1:f2]) mkEditForm
layoutListForm :: !([BodyTag] [BodyTag] -> [BodyTag])
!((InIDataId a) *HSt -> (Form a, *HSt))
! (InIDataId [a]) !*HSt -> (Form [a],!*HSt) | iData a
layoutListForm layoutF formF (init,formid) hst
layoutListForm layoutF formF (init,formid=:{mode}) hst
# (store, hst) = mkStoreForm (init,formid) id hst // enables to store list with different # elements
# (layout,hst) = layoutListForm` 0 store.value hst
# (store, hst) = mkStoreForm (init,formid) (const layout.value) hst
......
......@@ -238,24 +238,25 @@ where
mkForm :: !(InIDataId a) !*HSt -> *(Form a, !*HSt) | gForm {|*|} a
mkForm (init,formid=:{mode = Submit}) hst=:{submits = False}
# (form,hst) = gForm{|*|} (init,formid) {hst & submits = True}
# hst = {hst & submits = False}
# hidden = Input [ Inp_Name "hidden"
, Inp_Type Inp_Hidden
, Inp_Value (SV "")
] ""
# submit = Input [ Inp_Type Inp_Button
, Inp_Value (SV "Submit")
,`Inp_Events (callClean OnClick Submit formid.id)
,`Inp_Events (callClean OnClick Submit formname)
] ""
# clear = Input [ Inp_Type Inp_Reset, Inp_Value (SV "Clear")] ""
# sform = [Form [ Frm_Method Post
, Frm_Name formid.id
, Frm_Name formname
] (form.form ++ [hidden,Br,submit,clear])
]
= ({form & form = sform} ,hst)
where
formname = encodeString formid.id // to enable the use of any character in a form name
mkForm inidataid hst = gForm{|*|} inidataid hst
generic gForm a :: !(InIDataId a) !*HSt -> *(Form a, !*HSt)
gForm{|Int|} (init,formid) hst
......
......@@ -18,8 +18,8 @@ class iDataSerAndDeSerialize a
| gParse{|*|} // To de-serialize a string back to a value
, iDataSerialize a
TraceInput :== True // show what kind of information is received from Client
TraceOutput :== True // show what kind of information is stored
TraceInput :== False // show what kind of information is received from Client
TraceOutput :== False // show what kind of information is stored
MyDataBase :== "iDataDatabase" // name of database being used by iData applications
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment