This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 144499 - Add "id" attribute to generated form template
Summary: Add "id" attribute to generated form template
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: JSF (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: _ potingwu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-19 23:48 UTC by arungupta
Modified: 2008-09-09 22:18 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description arungupta 2008-08-19 23:48:14 UTC
JSF Form generated code template looks like:

-- cut here --
<h2>Detail</h2>
 <h:form>
  <h:panelGrid columns="2">
    <h:outputText value="Id:"/>
    <h:outputText value="#{anInstanceOfserver.Cities.id}" title="Id" />
    <h:outputText value="CityName:"/>
    <h:outputText value="#{anInstanceOfserver.Cities.cityName}" title="CityName" />
    <h:outputText value="CountryName:"/>
    <h:outputText value="#{anInstanceOfserver.Cities.countryName}" title="CountryName" />
  </h:panelGrid>
 </h:form>
-- cut here --

I think the generated template should also have an "id" attribute. This can be used for directing any error messages.
Comment 1 _ potingwu 2008-08-25 17:58:37 UTC
I will put it in the plan. Thanks!
Comment 2 _ potingwu 2008-09-03 18:46:16 UTC
I have looked into more details to see the JSF Form behavior and found that it does create an "id" attribute if the tag
is <h:inputText>!

E.g., from your example/blog, when drag-n-drop an JSF Form to the editor, check the default "Read-only", then you will
get all <h:outputText> without the "id" attribute as you described. For most cases, "id" is not very useful for
<h:outputText> tag.

        <h2>Detail</h2>
        <h:form>
            <h:panelGrid columns="2">
                <h:outputText value="Id:"/>
                <h:outputText value="#{anInstanceOfserver.Cities.id}" title="Id" />
                <h:outputText value="CityName:"/>
                <h:outputText value="#{anInstanceOfserver.Cities.cityName}" title="CityName" />
                <h:outputText value="CountryName:"/>
                <h:outputText value="#{anInstanceOfserver.Cities.countryName}" title="CountryName" />
            </h:panelGrid>
        </h:form>

If you check "Editable" instead of the default "Read-only", then you will get both <h:outputText> and <h:inputText>. And
the <h:inputText> tags do have "id" attribute generated.

        <h2>Create</h2>
        <h:form>
            <h:panelGrid columns="2">
                <h:outputText value="CityName:"/>
                <h:inputText id="cityName" value="#{anInstanceOfserver.Cities.cityName}" title="CityName" />
                <h:outputText value="CountryName:"/>
                <h:inputText id="countryName" value="#{anInstanceOfserver.Cities.countryName}" title="CountryName" />
            </h:panelGrid>
        </h:form>

In your blog, I suggest you use the "Editable", then you will not need the extra steps to change the outputText to
inputText, remove the first ID output, and add the "id" attribute.

If you agree, please close this issue as FIXED. Thanks!
Comment 3 _ potingwu 2008-09-09 22:18:17 UTC
The feature is complete; when checking "Editable", the <h:inputText> tags do have attribute "id" generated.