I am having problems with various match conditions that do not appear to be working.
This is the code and for test purposes, $:TLS/selectedstate!!state-code is set to -
The second <%if is not picking up the match condition and thus not displaying the message text. The first <%if works perfectly.
I have been looking at this some for time now to no avail. What am I doing wrong?
<%if [{$:/TLS/State/EditMode!!editMode}match[true]] %>
Add the information for the new gun below and press the //Add this gun// button
State Code: <$select tiddler="$:/TLS/selectedstate" field="state-code">
{{$:/TLS/Select/State}}
</$select>
OS for overseas, PRI for private
<%if [{$:/TLS/selectedstate!!state-code}match[-]] %>
Error - the selected state code can not be '-'
<%elseif [{$:/TLS/selectedstate!!state-code}!match[]] %>
The ID number for this new gun will be {{{ [{$:/TLS/incremental}addprefix[RAAHC]] }}}
City/Town: <$edit-text tiddler="$:/TLS/city" tag="input"/>
Location: <$edit-text tiddler="$:/TLS/location" tag="input"/>
Type: <$edit-text tiddler="$:/TLS/type" tag="input" size="50" />
Coordinates - Latitude: <$edit-text tiddler="$:/TLS/latitude" tag="input" overwrite="yes"/>
<br>
Format decimal, eg -33.1234
Coordinates - Longitude: <$edit-text tiddler="$:/TLS/longitude" tag="input" overwrite="yes"/>
<br>
Format decimal, eg 150.4567
Date of Manufacture: <$edit-text tiddler="$:/TLS/dateofmanufacture" tag="input"/>
Manufacturer: <$edit-text tiddler="$:/TLS/manufacturer" tag="input" overwrite="yes"/>
Serial Number: <$edit-text tiddler="$:/TLS/serialnumber" tag="input" overwrite="yes"/>
Weight of Projectile: <$edit-text tiddler="$:/TLS/weightofprojectile" tag="input" overwrite=“yes” />
Range: <$edit-text tiddler="$:/TLS/range" tag="input" overwrite="yes"/>
Calibre: <$edit-text tiddler="$:/TLS/calibre" tag="input" overwrite="yes"/>
Picture Link: <$edit-text tiddler="$:/TLS/pictureLink" tag="input" overwrite="yes"/>
<br>
The link for the main picture of the gun. Of the form //WA-image-0030//
<$button>
<$let
selectedstatecode={{$:/TLS/selectedstate!!state-code}}
selectedstatename={{{ [{$:/TLS/StateData}jsonget<selectedstatecode>] }}}
locationTag={{$:/TLS/location}}
typeTag={{$:/TLS/type}}
cityTag={{$:/TLS/city}}
>
<$action-createtiddler
$basetitle={{{ [{$:/TLS/incremental}addprefix[RAAHC]] }}}
caption={{{ [<selectedstatename>addsuffix[ : ]addsuffix<cityTag>addsuffix[ - ]addsuffix{$:/TLS/type}] }}}
tags={{{ [[All Guns]] [[Needs History]] [<cityTag>] [<selectedstatename >] [<locationTag>] [<typeTag>] +[format:titlelist[]join[ ]] }}}
ID={{{ [{$:/TLS/incremental}addprefix[RAAHC]] }}}
CityTown={{$:/TLS/city}}
Location={{$:/TLS/location}}
State=<<selectedstatename>>
GunType={{$:/TLS/type}}
DateofManufacture={{$:/TLS/dateofmanufacture}}
Manufacturer={{$:/TLS/manufacturer}}
SerialNumber={{$:/TLS/serialnumber}}
WeightofProjectile={{$:/TLS/weightofprojectile}}
Range={{$:/TLS/range}}
pictureLink={{$:/TLS/pictureLink}}
Calibre={{$:/TLS/calibre}}
Longitude={{$:/TLS/longitude}}
Latitude={{$:/TLS/latitude}}
$template="$:/TLS/CreateTemplateGun">
<$action-navigate $to=<<createTiddler-title>>/>
</$action-createtiddler>
<$action-createtiddler
$basetitle={{{ [{$:/TLS/incremental}addprefix[RAAHC]addsuffix[_History]] }}}
caption="History"
tags={{{ [{$:/TLS/incremental}addprefix[RAAHC]] }}}
parentGun={{{ [{$:/TLS/incremental}addprefix[RAAHC]] }}}
$template="$:/TLS/CreateTemplateHistory">
</$action-createtiddler>
<$action-createtiddler
$basetitle={{{ [{$:/TLS/incremental}addprefix[RAAHC]addsuffix[_Images]] }}}
caption="Images"
tags={{{ [{$:/TLS/incremental}addprefix[RAAHC]] }}}
parentGun={{{ [{$:/TLS/incremental}addprefix[RAAHC]] }}}
$template="$:/TLS/CreateTemplateImages">
</$action-createtiddler>
<$action-createtiddler
$basetitle={{{ [{$:/TLS/incremental}addprefix[RAAHC]addsuffix[_Why]] }}}
caption="Why"
tags={{{ [{$:/TLS/incremental}addprefix[RAAHC]] }}}
parentGun={{{ [{$:/TLS/incremental}addprefix[RAAHC]] }}}
$template="$:/TLS/CreateTemplateWhy">
</$action-createtiddler>
<$action-setfield $tiddler="Map" $field="parentGun" $value={{{ [{$:/TLS/incremental}addprefix[RAAHC]] }}} />
<$action-setfield $tiddler="Technical" $field="parentGun" $value={{{ [{$:/TLS/incremental}addprefix[RAAHC]] }}} />
<$action-setfield $tiddler="$:/TLS/dateofmanufacture" text=""/>
<$action-setfield $tiddler="$:/TLS/city" text=""/>
<$action-setfield $tiddler="$:/TLS/location" text=""/>
<$action-setfield $tiddler="$:/TLS/manufacturer" text=""/>
<$action-setfield $tiddler="$:/TLS/serialnumber" text=""/>
<$action-setfield $tiddler="$:/TLS/weightofprojectile" text=""/>
<$action-setfield $tiddler="$:/TLS/range" text=""/>
<$action-setfield $tiddler="$:/TLS/caption" text=""/>
<$action-setfield $tiddler="$:/TLS/pictureLink" text=""/>
<$action-setfield $tiddler="$:/TLS/longitude" text=""/>
<$action-setfield $tiddler="$:/TLS/latitude" text=""/>
<$action-setfield $tiddler="$:/TLS/calibre" text=""/>
<$action-setfield $tiddler="$:/TLS/type" text=""/>
<$action-setfield $tiddler="$:/TLS/selectedstate" $field="state-code" $value=""/>
<$action-setfield $tiddler="$:/TLS/selectedstate" $field="state-name" $value=""/>
<$action-setfield $tiddler="$:/TLS/incremental" text={{{ [{$:/TLS/incremental}add[1]] }}}/>
</$let>
Add new gun
</$button>
<%endif%>
<%else%>
Sorry, this function is only available in edit mode
<%endif%>
Also, the button for the Add new gun is a rectangle rather than the normal rounded rectangle.
bobj