Mohammad,
I am working on something similar so will avoid reviewing yours for now.
Note your typo "create-recoreds" should be "create-records".
Regards
Tony
On Wednesday, January 8, 2020 at 7:56:01 AM UTC+11, Mohammad wrote:
>
> The below code uses a button to create more input boxes to get
> field-name/field-value pairs from user.
> It then will be used to create a tiddler with many fields as user like!
>
> This works, but it seems a bit complicated!
>
> What do you propose?
>
>
> \define myTid() xx$:/temp/sample
> \define myfilter() [range[1,$(flt)$]]
> \define id_fldName() fldn$(cnt)$
> \define id_fldValue() fldv$(cnt)$
>
> \define create-recoreds()
> <$wikify name=flt text={{{ [<myTid>get[counter]]~[[1]] }}}>
> <$list filter=<<myfilter>> variable=cnt>
>
> <<getInputs>>
> </$list>
> </$wikify>
> \end
>
> \define getInputs()
> <$edit-text tiddler=<<myTid>> index=<<id_fldName>> tag=input default=""
> placeholder="field name"/>
> <$edit-text tiddler=<<myTid>> index=<<id_fldValue>> tag=input default=""
> placeholder="field value"/>
> \end
>
>
> <$button>add
> <$action-setfield $tiddler=<<myTid>>
> counter={{{[<myTid>get[counter]add[1]]~[[2]]}}}/>
> </$button>
> <$button>reset
> <$action-setfield $tiddler=<<myTid>> counter="1"/>
> <$action-setfield $tiddler=<<myTid>> text=""/>
> </$button>
>
> Number of records: <$count filter="[<myTid>indexes[]]" /><br>
> Counter: <$transclude tiddler=<<myTid>> field="counter"/><br>
>
>
> <<create-recoreds>>
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/c0552c94-efee-40c2-a929-ab05f0742919%40googlegroups.com.