History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: GRVY-623
Type: Bug Bug
Status: Open Open
Priority: Normal Normal
Assignee: Peter Gromov
Reporter: Vaclav Pech
Votes: 2
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
Groovy

Incorrectly highlighted label for in a gsp file

Created: 25 Oct 07 19:57   Updated: 13 Nov 08 17:16
Component/s: Grails editor support
Affects Version/s: None
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
File Attachments: None
Image Attachments:

1. .jpg
(29 kb)

2. grailsError.JPG
(204 kb)
Issue Links:
Depend
 
This issue is required for:
GRVY-881 wrong invalid id reference found thro... Minor Closed


 Description  « Hide
I generated a view, which contains a drop-down box to edit a relationship. The code works as expected, however, the gsp editor shows an error. See the attachment.
The error does not go away even after I change the name attribute of the g:select element to "event".

 All   Comments   Work Log   Change History      Sort Order:
Ilya Sergey - 26 Oct 07 18:07
The cause of error highlighting is in semantics of HTML tag "label". It's "for" attribute binds a label to another element. I. e. the value of the "for" attribute must be equal to the value of the "id" attribute of the related element.
In your example example labels "name" & "email" are binded to respective input elements in containing form. But element for label "event" is combo-box, generated by <g:select> Grails tag. If you look at it's body in FormTagLib class, you'll see that "id" attribute for this combo-box is name of your domain class "Event". But obviously in current implementation IDEA HTML annotator cannot check it by Groovy file.
May be one day we'll change model to implement this analysis.

Vaclav Pech - 29 Oct 07 15:31
All right. Thank you, Ilya for the explanation.

Galina McClain - 29 Feb 08 00:57
I am seeing the "Invalid id reference" in plain html snippet:
................
<tr>
<td width="10"/>
<td colspan="2">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td><label for="someId" class="mainBody">Pre-determined language: </label></td>
<td align="left">
<select name="someId">
<option value="0">(choose one)</option>
................

Eric Pederson - 02 Mar 08 02:51
Is there a way to filter out this error? It shows up as an error on all my GSP pages and also when I do a code analysis.

Eric Pederson - 02 Mar 08 03:07
I notice that if I add a matching id= attribute to the <g:select> tag it does propagate to the generated HTML, so IDEA should recognize g:select as a legitimate form tag and match the label for= properly.

I am going to log a bug to Grails that the scaffolding should add id= to the g:select tags.


Eugene Vigdorchik - 11 Mar 08 22:17
Please investigate it further. IDEA HTML has a knowledge of dynamic tags.