Page MenuHomePhabricator

Modify instances of a multiple-instance template that match specified criteria with #autoedit
Open, Needs TriagePublic

Event Timeline

This is already doable - just specify "template-name[instance-number][field-name]=value" in the query string. (The numbering of the instance numbers starts at 0.)

Yes but we can only target the instance with its position [1], [2], etc... and this can change or not be known. I'd like to target an instance with a value of a field or an unique ID to be sure to catch the good one.

Oh, I see - you want something like a "where=" parameter added to #autoedit. That would work for the value of a field, anyway - I don't know what you mean by a "unique ID".

Yes it could be something like that.

For exemple, I have a page containing this two instances of the same template :

{{MyTemplate
|ID=755
|field1=value1
|field2=value2
}}
{{MyTemplate
|ID=300
|field1=value1
|field2=value2
}}

I could choose and edit one of them with a call like that :

{{#autoedit: form=MyForm | target=MyPage | where=MyTemplate[ID]=300 | query string=MyTemplate[field1]=value15 }}

Right - well, "ID" there is just another field.

Yes ! Is it something difficult to implement ?

I would guess no, but I'm not sure.

This comment was removed by Paulibus.

Ok. I'm new and I don't know the process to purpose new features for the next PF version, Can you explain to me ? Is there a sort of job queue ?

Not really - it's kind of a random process, which features get added and bugs get fixed. The features and bugs that seem to be higher-priority usually end up getting done earlier. The two most effective ways to guarantee that an issue will get addressed are to submit a code patch that seems reasonable, or to pay a developer (like me) to do it.

+1 for this feature.

I set a mail to Semediawiki-user -mailing list a few days ago. I thought I just had some wrong understanding of "instance number". Now i see this is a feature that is not there at all.

Some thoughts about he |where - idea mentioned before:

If the ID is just another parameter within the multi-template call you still have to know it exactly when you place the autoedit call. ID can also change like the instance number. And you have to make shure that ID is unique. So you can not use it in templates where the autoedit call references to the page itself.
..
Another usecase is where the autoedit call is within the multi-template itself. Something like MyTemplate[{{#self}}][field1]=value could streamline the process of editing multiple instance templates without opening the form itself. #self (or whatever its name is) should determine the instance number of the item autoedit is in. Maybe there is another solution instead of implementing a new parser function.

Especially when the page has a larger number of multi-templates simple "hooking" of some items would be much easier.

instead of

  1. find item(s) on a page
  2. open the form
  3. find the item(s) again
  4. change value(s)
  5. save page

it would come like this

  1. find item(s) on a page
  2. change value(s) by klick
Yaron_Koren renamed this task from Add the possibility to edit a specific instance of a muliple-instance template with #autoedit to Modify instances of a multiple-instance template that match specified criteria with #autoedit.Apr 25 2023, 7:00 PM