Priority: Urgent
Current State: Closed
Released In: 2.1.4
Target Release: patch
See Support.Question1863
It appears that HTML 5 has a documented restriction that the <a> tag cannot contain nested elements such as the button tag.
See
http://stackoverflow.com/questions/802839/button-inside-of-anchor-link-works-in-firefox-but-not-in-internet-explorer
Also,
http://w3c.github.io/html/textlevel-semantics.html#the-a-element which states:
Content model:
Transparent, but there must be no interactive content or a element descendants.
which includes the button.
--
GeorgeClark - 23 Mar 2017
This patch removes the a tag and puts the url into an onClick, but it doesn't work. The URL looks right in the generated html, but it must be missing a class or something, as the javascript changes the topic name to "unknown".
diff --git a/EditRowPlugin/lib/Foswiki/Plugins/EditRowPlugin/Table.pm b/EditRowPlugin/lib/Foswiki/Plugins/EditRowPlugin/Table.pm
index 54f6645..e27583b 100644
--- a/EditRowPlugin/lib/Foswiki/Plugins/EditRowPlugin/Table.pm
+++ b/EditRowPlugin/lib/Foswiki/Plugins/EditRowPlugin/Table.pm
@@ -341,29 +341,26 @@ sub render {
# Full table editing is not disabled
my $title = "Edit full table";
+ my $url = Foswiki::Func::getScriptUrl(
+ $this->getWeb(), $this->getTopic(), 'view',
+ erp_topic => $active_topic,
+ erp_table => $id,
+ erp_row => -1,
+ '#' => 'erp_' . $id
+ );
my $button = Foswiki::Render::html(
'button',
{
type => 'button',
name => "erp_edit_${id}",
class => 'erp-edittable',
+ onClick => "location.href = '$url'",
title => $title
}
);
- my $url = Foswiki::Func::getScriptUrl(
- $this->getWeb(), $this->getTopic(), 'view',
- erp_topic => $active_topic,
- erp_table => $id,
- erp_row => -1,
- '#' => 'erp_' . $id
- );
push(
- @out,
- Foswiki::Render::html( 'a', { name => "erp_${id}" } )
- . Foswiki::Render::html( 'a',
- { href => $url, title => $title }, $button )
- . '<br />'
- );
+ @out, Foswiki::Render::html( 'a', { name => "erp_${id}" } )
+ . $button . '<br />');
}
elsif ( Foswiki::Func::isTrue( $this->{attrs}->{changerows} )
&& $this->{attrs}->{disable} !~ /row/ )
--
GeorgeClark - 23 Mar 2017
More likely this is what you need:
diff --git a/EditRowPlugin/lib/Foswiki/Plugins/EditRowPlugin/Table.pm b/EditRowPlugin/lib/Foswiki/Plugins/EditRowPlugin/Table.pm
index 0ec42579b..405a2576c 100644
--- a/EditRowPlugin/lib/Foswiki/Plugins/EditRowPlugin/Table.pm
+++ b/EditRowPlugin/lib/Foswiki/Plugins/EditRowPlugin/Table.pm
@@ -341,15 +341,6 @@ sub render {
# Full table editing is not disabled
my $title = "Edit full table";
- my $button = Foswiki::Render::html(
- 'button',
- {
- type => 'button',
- name => "erp_edit_${id}",
- class => 'erp-edittable',
- title => $title
- }
- );
my $url = Foswiki::Func::getScriptUrl(
$this->getWeb(), $this->getTopic(), 'view',
erp_topic => $active_topic,
@@ -361,7 +352,11 @@ sub render {
@out,
Foswiki::Render::html( 'a', { name => "erp_${id}" } )
. Foswiki::Render::html( 'a',
- { href => $url, title => $title }, $button )
+ { href => $url,
+ name => "erp_edit_${id}",
+ class => 'erp-edittable foswikiButton',
+ title => $title
+ }, '' )
. '<br />'
);
}
--
Main.CrawfordCurrie - 01 May 2017 - 15:47
Hi CDot .. close but no cigar.
I get a Table where the rendered button seems to be a miniatiure version of the table, complete with stain on the corner of a row.
%EDITTABLE{}%
| *A* | *B* |
| c | d |
Screenshot:
- editrow.png:

Generates:
...
<th class="foswikiTableCol0 foswikiFirstCol"> <a href="/Litterbox/TestItem14349?sortcol=0;table=1;up=0#sorted_table" rel="nofollow" title="Sort by this column"><span class='interactive_sort' data-sort='{"col":0,"reverse":0}'>A</span><a name='erp_TABLE_0_0'></a></a> </th>
...
--
GeorgeClark - 01 May 2017
The HTML issue is caused because the
EditRowPlugin adds the Anchor tag while the TML is not yet rendered. The TML is rendered later and the
TablePlugin adds the surrounding Sort link. If it's fixable, it probably has to happen in the
TablePlugin.
--
GeorgeClark - 01 May 2017
The following patch fixes the out-of-order anchor tags:
diff --git a/TablePlugin/lib/Foswiki/Plugins/TablePlugin/Core.pm b/TablePlugin/lib/Foswiki/Plugins/TablePlugin/Core.pm
index 3e2244b..b65cb61 100644
--- a/TablePlugin/lib/Foswiki/Plugins/TablePlugin/Core.pm
+++ b/TablePlugin/lib/Foswiki/Plugins/TablePlugin/Core.pm
@@ -1685,6 +1685,10 @@ sub emitTable {
title => 'Sort by this column'
};
+ if ( $cell =~ s/(<a name='erp_TABLE.*?'><\/a>)//o ) {
+ $tableAnchor .= $1;
+ }
+
if ( $cell =~ /\[\[|href/o ) {
$cell .= CGI::a( $linkAttributes, $CHAR_SORT_BOTH )
. $tableAnchor;
--
GeorgeClark - 02 May 2017
Crawford. Any thoughts. It's a cosmetic issue right now. And the fix intermixes two plugins.
--
GeorgeClark - 02 May 2017
I'd rather see us accepting this link as a fait accompli and putting some effort into testing / extending
JQTablePlugin.
--
CrawfordCurrie - 02 May 2017