Question
I have a html form submitting values to the edit script using a templatetopic that has a TWiki Form attached. This works very well. The problem is that I would like to cut out the edit and just go straight to the saved topic. It's only one click in this particular instance, but I'd like to get he save script worked out for some other automation reasons as well. The issue is that when I switch the script from edit to save, it doesn't seem to be picking up the templatetopic and the attached form. Here's my form:
<form name="New" action="%SCRIPTURLPATH{edit}%/%WEB%/">
<input type="hidden" name="templatetopic" value="NewIssueTmpl" />
<input type="hidden" name="topic" value="%SERVERTIME{$year$month$day}%_XXXXXXXXXX" />
<input type="hidden" name="action" value="form" />
.
.
.
<input type="hidden" name="onlywikiname" value="off" />
<input type="hidden" name="onlynewtopic" value="on" />
<input type="hidden" name="Status" value="Open" />
<input type="submit" class="twikiSubmit" value="Create" />
</form>
So when I change the
%SCRIPTURLPATH{}%
to save, and change the
action
field to the
action_save
field and give it a value of
1
, I expect to get the saved topic, with the
templatetopic
info including the attached TWikiForm and populated values. What I'm getting is a new topic with the correct
topic
name but nothing from the
templatetopic
or TWikiForm.
Any help would be greatly appreciated.
Environment
--
MatthewCardozo - 13 Sep 2006
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
Try using just the
%SCRIPTURL{"save"}%
and drop the
action
parameter completely. You don't need both and perhaps they are conflicting. Also, the
action
attribute set to
form
would only be needed in edit mode.
--
LynnwoodBrown - 13 Sep 2006
so, i used just
%SCRIPTURLPATH{"save"}%
and took out the
action
attribute. Got the same results. Then I tried using
%SCRIPTURL{"save"}%
after rereading your post and thought maybe there was some difference between the two that might make a difference...unfortunately not. Same results.
--
MatthewCardozo - 13 Sep 2006
Hmmm. I don't know what to suggest...
Here's a few shots in the dark:
- Move the
templatetopic
form element after the topic
element.
- Try including a
formtemplate
form element that references the form you want used. As I remember the spec, you shouldn't need this if the template topic has that form, but it's worth a try.
--
LynnwoodBrown - 13 Sep 2006
Those are both very good suggestions. I've tried them both and gotten no better results however. I even tried using just the
formtemplate
element without the
templatetopic
element and still no dice.
I was a little worried it might just be my TWiki so I setup an example on the Sandbox web at
TestSaveScript. I created
TestSaveScriptTmpl and attached
WebForm to it. Getting the same results there. Very odd. Could this be a bug that nobody noticed because they don't use the functionality? Seems pretty strange to me.
--
MatthewCardozo - 13 Sep 2006
It's working now. The only changes I made were:
- Putting the templatetopic form element after the name.
- Removing the forward slash after the
%WEB%
in the action. This might have been the problem.
I knew this feature was working because I use it all the time.
--
LynnwoodBrown - 13 Sep 2006
OK, made some discoveries here. I made the changes on my local system and still got the same bad results. So I started comparing with the one on the Sandbox. I have the two lines...
<input type="hidden" name="onlywikiname" value="off" />
<input type="hidden" name="onlynewtopic" value="on" />
...in my form. I took those out and it worked. It turns out it doens't like the
onlywikiname
parameter. I don't know why, and it still lets me create the topic with a non wikiword. Thanks for your help on this. It was a bit frustrating
--
MatthewCardozo - 13 Sep 2006
Opp! Sorry I wasn't more careful in reporting what I changed! Thanks for the work on that Matthew. There
might be a bug lurking somewhere in what you found there. On the other hand, perhaps the problem was that the topic naming element didn't conform to
WikiWords. It may be that the underlines were the problem.
--
LynnwoodBrown - 14 Sep 2006
The only issue I see with that explanation is that I was setting that option to off, so it shouldn't be making sure it was a wikiword. On that same subject, the topic was always getting created, it just wasn't picking up the templatetopic setting. So it didn't seem to mind the onlywikiname setting either way in that regard.
--
MatthewCardozo - 05 Oct 2006