RPTools.net
http://forums.rptools.net/

[Bug 1.4.1.7?]Form submit arguments and input values
http://forums.rptools.net/viewtopic.php?f=86&t=27446
Page 1 of 1

Author:  aliasmask [ Tue Nov 07, 2017 8:31 pm ]
Post subject:  [Bug 1.4.1.7?]Form submit arguments and input values

I think I may have found a bug. If I enter an argument value as a part of the <form action> it just concatenates the value to any <input> values passed to the processing macro in macro.args. The method is set to json. The input values are done correctly and put in to a json array. But the arguments set in the action (see Wiki: macroLinkText()) are oddly added to json. So, if I just put "test" as an argument and let's say I had no input other than submit value="test2" then my macro.args would look like this:

Code:
["test{"submit":"test2"}"]


This is not a json. Looks like there is no comma and the quote is in the wrong place.

This is what I would expect.

Code:
["test",{"submit":"test2"}]


If I had a json array, like ["test","test1"] as the argument, then it would be:

Code:
["test","test1",{"submit":"test2"}]

OR (probably better as)
Code:
[["test","test1"],{"submit":"test2"}]


As is the above format gives an error because of the bad formatting.

If I had a json object like this: {"test":1,"test1":2}, then I would expect this:

Code:
[{"test":1,"test1":2},{"submit":"test2"}]


All the argument data would be in the 0 index of the array and input data in the 1 index. If there was no argument with the json method then it would pass a json object. Checking the macro.args type would be a good way to know if there was argument data.

For now, the workaround is not to use the argument parameter with the json method. If you need to have a set argument, then use <input type=hidden>.

---

Also, if someone does try to tackle this, there's also this: viewtopic.php?f=21&t=26731&p=263585&#p263585

Look at the next post in thread by me for the TL;DNR.

---

Let me add to this. When I pass &nbsp; as part of the value of an input, like when I format the text on a submit button, the form processes it as %EF%BF%BD which gives me the little square value which I assume is MT's unknown character. In my case, this isn't important but it's unexpected behavior.

Page 1 of 1 All times are UTC - 6 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/