Puting spaces in a tag from user input

74 views
Skip to first unread message

damien Dupont

unread,
Aug 21, 2019, 3:04:50 PM8/21/19
to TiddlyWiki
Hello,

I wrote a a code that has the purpose to create in the background a new tiddler with a some tags and one of those tags is the user input from an edit-text widget. The problem is that if the user write something with space ex : "A chair", the created tiddler will have "A" and "chair" as tag instead of on tag "A chair". Has someone an idea how to solve this ?

Extract of my code :

\define concat() request {{$:/temp/RequestScannedPart}}

Scanned part :<$edit-text tiddler="$:/temp/RequestScannedPart" tag="input" placeholder="New part" default=""/>

<$button>
<$wikify name="tagToSend" text=<<concat>>>
<$action-setfield $tiddler={{$:/temp/RequestName}} $field="tags" $value=<<tagToSend>>/>
</$wikify>

Create
</$button>

Mark S.

unread,
Aug 21, 2019, 5:07:28 PM8/21/19
to TiddlyWiki
The solution is not intuitive, but here you go. There's a special technique for adding new tags. You could
also do this with the action-listops widget.

Scanned part :<$edit-text tiddler="$:/temp/RequestScannedPart" tag="input" placeholder="New part" default=""/>

<$fieldmangler tiddler={{$:/temp/RequestName}} >
   
<$button>
 
<$action-sendmessage $message="tm-add-tag" $param={{$:/temp/RequestScannedPart}} />
 
   
Create
   
</$button>
<$fieldmangler>


Click here to Reply


damien Dupont

unread,
Aug 22, 2019, 1:49:30 AM8/22/19
to TiddlyWiki
It works perfectly, thanks a lot :)

Sycom

unread,
Aug 22, 2019, 2:15:13 AM8/22/19
to TiddlyWiki
Hello,

Another, less elegant but more intuitive solution could be

```
\define concat() <$text text="[["/>request {{$:/temp/RequestScannedPart}}<$text text="]]"/>

Scanned part :<$edit-text tiddler="$:/temp/RequestScannedPart" tag="input" placeholder="New part" default=""/>

<$button>
<$wikify name="tagToSend" text=<<concat>>>
<$action-setfield $tiddler={{$:/temp/RequestName}} $field="tags" $value=<<tagToSend>>/>
</$wikify>

Create
</$button>
```

There are often (always?) various way to do something in TW... A good way to find your path is describing your goals rather than putting your solution for a review.

Cheers

Sylvain
@sycom

damien Dupont

unread,
Aug 22, 2019, 10:59:18 AM8/22/19
to TiddlyWiki
Thanks for your contribution ;)
Yes, there are several ways to do things in tiddly wiki, I will remember your advice next time.

It require a lot of time to understand all the aspects of TW. I manage to do some amazing things but the majority of problem I encouter are related on how TW handles spaces into variables or do I need to put " in a widget parameter or not. It's kind of frustrating XD

Sylvain Comte

unread,
Aug 22, 2019, 11:39:55 AM8/22/19
to tiddl...@googlegroups.com
Don't give up Damien ;-)

Glad to have another hacker aboard.

The issues you describe is often caused by a (kind of) scattered documentation / ressources and also difficulties to "think the tiddly way". I know that pretty well and I'm often amazed by other's solutions I would never have found. 

Am I wrong or you may also take advantage of https://forum.tiddlywiki.fr
You will find a bunch of talented, adventurous and french speaking "bricoleurs" there.

Warm regards

Sylvain
@sycom

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/cFcOsTQ1Q5I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/c6f9b53c-09d4-40be-a521-0aacf0361916%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages