Hi
When trying to edit an existing page with the api action sfautoedit or the parser function #autoedit there seems no way to clear an existing field. E.g.:
I have the page content
{{item |name=thingy |status=incoming |arrival date=tomorrow }}
When trying to
{{#autocreate: |form=items |target=example page |query string=item[status]=available&item[arrival date]=&item[in stock]=42 }}
the resulting page looks like
{{item |name=thingy |status=available |arrival date=tomorrow |in stock=42 }}
I tried with and w/o setting preload=
Then, I did some debugging of SF_AutoeditAPI.php to try to fix this but got lost somewhere between line 912 and 956. Seems to me that the call of $sfgFormPrinter->formHTML in line 927 is subsequently ignored and redone in line 960. This first one correctly omits the cleared field, the second doesn't. I then gave up my efforts trying to sort through SF_FormPrinter.php. Sry.
Problems seems to be that somewhere the distinction between a field that is omitted from the query string and one that is set to an emtpy string is lost. The edit action then treats them both the same way: keep the original value.
Note: omitting a field, setting it to false or submit a bunch of spaces is all treated the same way.
What happens with a field that is omitted is a matter of personal taste, I think. But clearing a field is something one could need now and then. Is it possible to extend the functionality? Or better yet: did I do something wrong (in which case, please tell me how to do it)?
Regards,
Tobi