Skip to content

Commit

Permalink
Fixes #798 - Encoding on buttonTo.
Browse files Browse the repository at this point in the history
  • Loading branch information
perdjurner committed Jun 15, 2017
1 parent b44a500 commit 15b4d91
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions wheels/tests/view/urls/buttonTo.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ component extends="wheels.tests.Test" {
set(functionName="buttonTo", encode=true);
}

function test_buttonto_inner_encoding() {
actual = _controller.buttonTo(text="<Click>", class="form-class", inputClass="input class", confirm="confirm-value", disable="disable-value", encode=true);
expected = '<form action="#application.wheels.webpath#" class="form-class" confirm="confirm-value" disable="disable-value" method="post"><input class="input&##x20;class" type="submit" value="&lt;Click&gt;"></form>';
assert('actual eq expected');
}

function test_buttonto_attributes() {
actual = _controller.buttonTo(class="form-class", inputClass="input-class", confirm="confirm-value", disable="disable-value");
expected = '<form action="#application.wheels.webpath#" class="form-class" confirm="confirm-value" disable="disable-value" method="post"><input class="input-class" type="submit" value=""></form>';
Expand Down
4 changes: 3 additions & 1 deletion wheels/view/links.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,15 @@ public string function buttonTo(
local.args = $innerArgs(name="input", args=arguments);
local.args.value = arguments.text;
local.args.image = arguments.image;
local.args.encode = arguments.encode;
local.content &= submitTag(argumentCollection=local.args);
local.skip = "image,text,route,controller,key,params,anchor,onlyPath,host,protocol,port,encode";
if (Len(arguments.route)) {
// variables passed in as route arguments should not be added to the html element
local.skip = ListAppend(local.skip, $routeVariables(argumentCollection=arguments));
}
return $element(name="form", skip=local.skip, content=local.content, attributes=arguments, encode=arguments.encode, encodeExcept=local.encodeExcept);
local.encode = arguments.encode ? "attributes" : false;
return $element(name="form", skip=local.skip, content=local.content, attributes=arguments, encode=local.encode, encodeExcept=local.encodeExcept);
}
/**
Expand Down

0 comments on commit 15b4d91

Please sign in to comment.