SID-00417: Copy Table Row To Another Table In The Same Topic.
| Status: |
Answered |
TWiki version: |
4.2.4 |
Perl version: |
|
| Category: |
CategoryJavaScript |
Server OS: |
SUSE Linux 2.6.5 |
Last update: |
16 years ago |
Hi There I am currently running some JS to conditionally format table cells and while I am looking at the td contents if I see a cell with a keyword I want to copy it to another table in the same topic.
Has anyone tried this?
The reason behind this is to preserve deleted table entries from the main table.
Many thanks
Paul
--
PaulGreen - 2009-07-14
Discussion and Answer
I have not tried this with JS. Alternatively you could use a
FormattedSearch on the topic with multiple="on" to identify table rows, and use a format="" with a regular expression to pull table cell(s) of interest.
--
PeterThoeny - 2009-07-16
OK Great, Thanks Peter, I will have a read and a play. I will see if I can work that one out.
-Paul
--
PaulGreen - 2009-07-16
Ok so I was looking into this and I am not sure how the formatted search will work? Wouldn't this be called every time the topic is loaded?
I think I just need to have a one off copy of a row to a list or another table in the same topic if the cell in question is changed to completed.
Not sure how to do this I will have to think on it, unless anyone else has any ideas?
--
PaulGreen - 2009-07-17
Is this the idea?
- Copy Table generated with search below
%SEARCH{ "[d]ata" topic="SID-00417" type="regex" multiple="on" nosearch="on" nototal="on" format="| $pattern(^\|
(.?)
\|.) |" }%
--
HugoDeLaCerda - 2009-08-01
This is the option that retains old values in a running log.
(example comes from our shipping log)
<form name="version" action="%SCRIPTURLPATH{save}%/%WEB%/%TOPIC%">
<input type="hidden" name="method" value="POST" />
<input type="hidden" name="validate" value="on" />
<input type="hidden" name="onSubmit" value="return (twiki.Form.makeSafeForTableEntry) ? twiki.Form.makeSafeForTableEntry(this) : true;" />
<input type="hidden" name="LogedBy" value="%USERNAME%" />
<input type="hidden" name="LogedDate" value="%SERVERTIME%" />
<input type="hidden" name="comment_action" value="save" />
<input type="hidden" name="comment_type" value="version" />
<input type="hidden" name="comment_templatetopic" value="%WEB%.%TOPIC%" />
<input type="hidden" name="comment_location" value="<!--InsertPoint-->" />
<table width="100%"><tr><td valign="top">
Source <input type="text" name="Source" size="44" value="%FORMFIELD{"Source"}%" /><BR><BR>
ID <input type="text" name="ID" size="50" value="%FORMFIELD{"ID"}%" /><BR><BR>
</td><td valign="top"></td><td valign="top">
<a name="FormElementDescription"></a>
<p> <span class="formPluginTitle">Description</span><br /> <textarea name="Description" rows="4" cols="50" class="twikiInputField">%FORMFIELD{"Description"}%</textarea> </p>
</td></tr></table>
</form>
%STARTFORM{
name="formstorage"
noformhtml="on"
}%
%FORMELEMENT{
name="Storage"
type="select"
size="1"
onChange="HIDE();"
title="Item Storage Location"
default="%FORMFIELD{"Storage"}%"
}%
%FORMELEMENT{
name="Destination"
type="text"
size="25"
title="Destination"
beforeclick="%IF{"$'FORMFIELD{Destination}' = ''" then="Specify..." else="%FORMFIELD{"Destination"}%"}%"
}%
%FORMELEMENT{
type="submit"
buttonlabel="Submit"
}%
%ENDFORM%
*Tape Log History:*
%TABLE{id="datatable"}%
| *Description* | *ID* | *Date Logged* | *User* | *Source* | *Storage* | *Destination* |
<!--InsertPoint-->
%TMPL:DEF{OUTPUT:version}%%POS:BEFORE%| %URLPARAM{"Description"}% | %URLPARAM{"ID"}% | %URLPARAM{"LogedDate"}% | %URLPARAM{"LogedBy"}% | %URLPARAM{"Source"}% | %URLPARAM{"Storage"}% | %URLPARAM{"Destination"}% |
%TMPL:END%
This form will create something like this every time it is submitted:
Tape Log History:
| Description |
ID |
Date Logged |
User |
Source |
Storage |
Destination |
| Some Box |
ID-200001 |
27 Apr 2009 - 09:38 |
SomeUser |
Out of House |
Bin # 3 |
|
| Some Box |
ID-200001 |
29 Apr 2009 - 05:38 |
OtherUser |
InHouse |
Not Here |
Client took it back |
| Some Box |
ID-200001 |
30 Apr 2009 - 12:38 |
SomeUser |
Out of House |
Bin # 3 |
|
- For this to work you need a topic with a form attached with the fields "Description, ID, LogedDate, LogedBy, Source, Storage and Destination".
--
HugoDeLaCerda - 2009-08-06
Seems to be answered?
Closing this question after more than 30 days of inactivity. Feel free to reopen if needed. Consider engaging one of the
TWiki consultants if you need timely help. We invite you to
get involved with the community, it is more likely you get community support if you support the open source project!
--
PeterThoeny - 2009-10-01
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.