I don't know much about this kind of thing so someone else can probably 
answer this much better but from old projects I do know that's not a good 
way to try and get a field value.

This should give you the count: 

<script>
var title = story.findContainingTiddler(place).getAttribute("tiddler") ;
var field = store.getTiddler(title).fields.mantraCount ;
document.write(field );
</script>


On Saturday, April 27, 2013 2:39:21 PM UTC-7, passingby wrote:
>
> I am trying to create a tiddler which shall have a field named 
> "mantraCount". The field shall be set to 0 in the beginning. The tiddler 
> shall display the current value of the field in its display and it shall 
> have a large button below which shall increment the field value by 1 when 
> pressed and refresh the tiddler display in order to show the latest field 
> value.
> In my MainMenu I have this to create a new Mantra Counter tiddler:
>
> <<newTiddler 
>    label:"New Mantra Counter" 
>    title:"New Mantra" 
>    tag:"mantra"
>    text:{{store.getTiddlerText("NewMantraText")}}
>    fields:"mantraCount:0"
> >>
>
>
> The content of the the NewMantraText is automatically appended into each 
> New Mantra tiddler created with the New Mantra Counter button :
>
> <script>
> var title = story.findContainingTiddler(place).getAttribute("tiddler");
> var field=story.getTiddlerField(title,"mantraCount"); 
> document.write(field);
> </script>
>
> I have not completed the NewMantraText yet. Eventually it shall have a 
> button which shall do the real incremental work. But for now the problem is 
> the variable 'field' is evaluating to null.
> Can you please tell me why and how to solve this?
> Here is the link to a minimal test case in my dropbox
> https://www.dropbox.com/s/nxlgwqkuujkr2df/mtc.html
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to