Last modified: 2013-07-02 14:12:06 UTC
Hi, When doing the following: {{{field |url |text |default=http://sdf.com?xxx=yyy&zzz=aaa |maxlength=3000 |mandatory}}} and when loading the form, the form field value gets set to: <a rel="nofollow" class="external free" href="http://sdf.com?xxx=yyy&zzz=aaa">http://sdf.com?xxx=yyy&zzz=aaa</a> instead of the proper unformatted value: http://sdf.com?xxx=yyy&zzz=aaa I tried wrapping the default value with <nowiki> but that doesn't work. PLEASE NOTE: The description of how to reproduce above is just the most isolated way. Realistically, I'm actually setting the default dynamically with {{#urlget:...}} like so: default={{#urldecode: {{#urlget:url}} }} But, I removed the urlget, and urldecode, just to isolate the problem and hard-coding the default to a URL produces the same problem exactly. Thanks, Al
I'm not a php programmer, but I've done a little tracing and in SF_FormPrinter.php line 817 this is called: $default_value = $wgParser->recursiveTagParse( $sub_components[1] ); and then the actual converting of the link to the marked-up version happens in Parser.php line 1166: $text = $this->doMagicLinks( $text ); Hope this helps. Q: Just a guess, but should the default value be parsed as markup like it is?
Yes, sometimes it makes sense to parse the default value - like when it contains an #ask query. It's really only when it holds a URL that problems seem to occur.
I'm musing on a private fix for this with a new param for the parser to skip the doMagicLinks() call. Is the presence of '#ask' the only thing to test for?
Well, if it's a private fix, it depends entirely on what's in your wiki.
I mean are there any other reasons, other than #ask, that a default value may need to be parsed?
Sure - #ifexists, #time, #expr, #show....