SID-00833: Update Form Field in another Form
| Status: |
Answered |
TWiki version: |
4.3.2 |
Perl version: |
5.8.8 |
| Category: |
CategoryForms |
Server OS: |
Red Hat Enterprise Linux Server release 5.1 (Tikanga) |
Last update: |
15 years ago |
Hi
I have a question, i need update a form field in a diferent topic that I'm editing. Are there simple way for to make this? I think in ajax o something, but i prefer that you suggest me
Thanks
--
DavidLopez - 2010-05-11
Discussion and Answer
No need for Ajax, create an HTML form that calls the save script on the other topic. Here is an untested example, assuming topic OtherTopic having a form called "Title":
<form action="%SCRIPTURL{save}%/%WEB%/OtherTopic" method="post">
Title:
<input type="text" name="Title" size="50" value="" class="twikiInputField" />
<input type="submit" value="Submit" class="twikiSubmit" />
</form>
Details in
TWikiScripts,
TWikiForms,
TWikiTemplates.
--
PeterThoeny - 2010-05-11
Thanks for reply, i have doubts
Can I submit two different forms from one topic for update two different topic? How do I control the new page that would be loaded?
Thanks
--
DavidLopez - 2010-05-12
I have built a
FormattedSearch before where a table cell within search format contains an HTML form with a picklist. This results in a table showing topics, each row has a picklist and a subit button. Is this what you are looking for?
--
PeterThoeny - 2010-05-12
Maybe I have not given a good explanation, I am going to try to clarify it.
I have two topics: topic1 and topic2, each of them with two different forms. If i editing the form of topic1, i want that in submit, the value of one of the fields in topic1.form is copied in one of the fields in topic2.form. And then load the topic1
- Editing Topic1.form -> submit
- actions:
- Topic1.form.field1 = valueX
- Topic2.form.field2 = valueX
- View topic1.
In any case I have solved already it by another way.
Thanks
--
DavidLopez - 2010-05-14
I do not recommend to have the same information stored twice. It can get out of sync, such as when a user changes Field2 of Topic2. You could reference Field1 of Topic1 in Field2 of Topic2, such as
%FORMFIELD{ "Field1" topic="Topic1" }%.
Could you share your solution so that the TWiki community can learn?
--
PeterThoeny - 2010-05-14
Hi
I haven't the same information store twice, maybe I have not explained myself very well.
I try to create a autoincrement field in template form.
For make this i think two possible solutions.
1.- In the new field topic, create a fieldform for store de last integer generate. When a new topic is created with this field i need increment de fieldform in the field topic and copy/paste the new value in the new form for the new topic.
- new fieldform in form1 for template1
- new form2 in NewFieldTopic for store the last integer.
- When new topic in this template1 is create
- Increment the form2 in the NewFieldTopic
- Copy the value in the new topic of the template.
2.- When newTopic of template1 is created, search in all of this topic the last integer and increment and copy in new form.
To avoid duplicate ID i make the following thing:
- When the newTopic is save for 1st time:
- In the view mode ,with a javascript, create a new form with the new value for the increment field and submit for increment the field. There are one "problem" for this, I must send the form twice.
Now I have the problem of which the field I cannot do it readonly.
I hope that it is understood.
Thanks.
--
DavidLopez - 2010-05-18
If you think of a unique key per record I would use the topic name as key. TWiki has an AUTOINC feature for topic names, e.g. for topic name
BugIDAUTOINC0001 you will get topics
BugID0001,
BugID0002,
BugID0003, etc. See
TWikiTemplates for details.
If you want to build the next available number in a form field you can use a
SpreadSheetPlugin formula that calculates the next value. Put that into a hidden input field with name of your TWiki form field.
--
PeterThoeny - 2010-05-18
Thanks,
I use the
SpreadSheetPlugin but I have tried to reduce the possibility of creating 2 IDs equals autosending the Id value in the first view of the new topic.
It is possible that a field of the form is readonly?
It is to make that only my source can update the Id field.
Bye
--
DavidLopez - 2010-05-20
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.