Thanks, between that snippet and a the link from Mark S. I've managed to 
bodge something together here:

https://gist.github.com/anonymous/0fe8827db322790def01

IP: <$edit-text tiddler="$:/temp/host" tag="input" type="text" />
Port: <$edit-text tiddler="$:/temp/port" tag="input" type="text" />

<$ajaxButton message="ed-ajax" class="ed-ajaxButton" param=
"http://{{$:/temp/host}}:{{$:/temp/port}}/state"; set="$:/ed/ajaxResult">Get 
state</$ajaxButton>

<html><pre>{{$:/ed/ajaxResult}}</pre></html>

And a little custom style to add a little "JS" badge to the buttons:

.ed-ajaxButton:after {
    content: "JS";
    background-color: #fc0;
    padding: 4px;
    border: 1px solid #930;
    margin-left: 8px;
}

It's a little clunky but seems to get the job done.
Thanks all,

    Mike


On Tuesday, 18 August 2015 07:04:43 UTC+1, BJ wrote:
>
> Hi Mike, you can enter text with a button like this:
>
> <$button set="$:/myvar" setTo={{$:/temp/var}}>press to enter</$button> 
> <$edit-text tiddler="$:/temp/var" tag="input" type="text"/>
>
>  --- 
> <$text text={{$:/myvar}}>
>
> The text widget is very easy to understand - if you look at the source, 
> you could probably start by adding some javascript to the render function.
>
> Cheers
>
> BJ
>
> On Monday, August 17, 2015 at 12:28:56 PM UTC+1, Mike Sutton wrote:
>>
>> What I'm looking to be able to do is for the user to enter some text in a 
>> text box in a tiddler, press a button and have a piece of JavaScript run 
>> using the contents of the text box as input.  Having the output of the 
>> JavaScript function injected into the page somehow is a bonus, but if not 
>> then a simple alert box or console.log would suffice.
>>
>> I've been looking into macros, but have yet to find any that use this 
>> sort of dynamic input/output.
>>
>> This is pretty simple to accomplish in vanilla web development, but I'm 
>> trying to write it the Tiddly way, any pointers?
>>
>> Thanks,
>>
>>     Mike
>>
>

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/61a5dfff-fa3d-4f19-84f0-5188f3c7ecf3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to