input in sitetitle with action-sendmessage

69 views
Skip to first unread message

Gerald Weis

unread,
Mar 6, 2020, 7:43:28 AM3/6/20
to TiddlyWiki

Hi folks,

i have a problem with coding the function.

The code should do the follow hings:
1. create a optionfield with the options in the selectfunction: works
2. create an inputfield for licenceplate: works
3. create an tag in the new tiddler from inputfield: works
4. create an inputfield for the year: works.
5. create the title of the new tiddler from the {$:/SiteTitle} and append the inputfield year: dont work.

i dont know what is wrong

thanks for help


\define zyklusa(licence-plate year)
<$select tiddler='$:/SiteTitle' tooltip='select tiddler wich should will cloned'>
<option value="Benzin - Jahr">Benzin</option>
<option value="Fahrzeugpflege - Jahr">Fahrzeugpflege</
option>
<option value="Inspektionen und TÜV - Jahr">Inspektionen und TÜV</option>
<option value="Räder: Reifen und Felgen - Jahr">Räder: Reifen und Felgen</
option>
<option value="Reparaturen und Wartung - Jahr">Reparaturen und Wartung</option>
<option value="Scheibenwischer - Jahr">Scheibenwischer</
option>
<option value="Versicherung - Jahr">Versicherung</option>
<option value="Zulassung - Jahr">Zulassung</
option>
</$select>

<$vars ph="Geben Sie die unten verlangten Angaben ein:">
''<<ph>>''<br/
><br>
''licence-plate car:'' <$edit-text tiddler="$:/temp/licence-plate" tag=input size=20  placeHolder=<<ph>> default="licence-plate"/><br/>
''&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;year der Ausgabe:'' <$edit-text tiddler="$:/temp/year" tag=input size=10 placeHolder=<<ph>> default="2020"/><br/>
</$vars>

<$button> clone selected tiddler
<$action-sendmessage $message="tm-new-tiddler" $param={{$:/
SiteTitle}} $value={{$:/SiteTitle}} [[$year$ ]] tags=[[$licence-plate$]] />
</$button>
\end

<$macrocall $name=zyklusa
licence-plate={{$:/temp/licence-plate}}  tiddler={{$:/SiteTitle}} year= {{$:/temp/year}} tags=[[$licence-plate$]] />


Mat

unread,
Mar 6, 2020, 10:19:14 AM3/6/20
to TiddlyWiki
4. create an inputfield for the year: works.
5. create the title of the new tiddler from the {$:/SiteTitle} and append the inputfield year: dont work.

<$action-sendmessage $message="tm-new-tiddler" $param={{$:/SiteTitle}} $value={{$:/SiteTitle}} [[$year$ ]] tags=[[$licence-plate$]] />

That "year" parameter looks suspicious. Shouldn't it be year=[[$year$ ]] ? Maybe the $year$ messes with the $value parameter?

<:-) 

Gerald Weis

unread,
Mar 6, 2020, 2:33:25 PM3/6/20
to TiddlyWiki
Thats not the solultion.
i have testet it.

Mark S.

unread,
Mar 6, 2020, 2:53:05 PM3/6/20
to TiddlyWiki
It may not be the only problem, but

tags=[[$licence-plate$]]

is wrong. The substitution variable $license-plate$ does not exist until the macro is called.

TonyM

unread,
Mar 6, 2020, 5:31:43 PM3/6/20
to TiddlyWiki
In the last step that is broken

$value={{$:/SiteTitle}} [[$year$ ]]

Is not valid. To concatenate these values which you seem to intend you can't do it in a parameter unless its only substitutions

$value="$SiteTitle$ [[$year$]]"

you can also define an additional macro that does the concatenation

\define temp(year) {{$:/SiteTitle}} [[$year$]]

Then $value=<<temp $year$>>

untested but expected to work

Its only in filters you can't use a macro that includes a parameter such as year in the above temp macro.

The short form of calling a macro is sometimes better done using the long form the Macrocall widget.

Regards
Tony

Mat

unread,
Mar 6, 2020, 6:12:51 PM3/6/20
to TiddlyWiki
Also, I think there should be a comma in this

\define zyklusa(licence-plate year)

i.e

\define zyklusa(licence-plate, year)

Admittedly,  the docs seems to say that a space should be enough:

The parameter separator (sep) is any sequence of characters that does not match a param-name. 
Among other things, this includes commas, spaces and linefeeds.

... but I suspect this is not correct as I've never seen it with anything but a comma or comma+space there. 
 
<:-)

TonyM

unread,
Mar 6, 2020, 7:08:19 PM3/6/20
to TiddlyWiki
FYI

Admittedly,  the docs seems to say that a space should be enough:

I never use commas. So I am not sure that is true

 

The parameter separator (sep) is any sequence of characters that does not match a param-name. 
Among other things, this includes commas, spaces and linefeeds.

... but I suspect this is not correct as I've never seen it with anything but a comma or comma+space there. 
 
<:-)

Regards
Tony 
Reply all
Reply to author
Forward
0 new messages