Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7872805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:19:17+00:00 2026-06-03T02:19:17+00:00

I am new to the play framework (I use the Java version). I am

  • 0

I am new to the play framework (I use the Java version). I am looking for a solution to add a selected=”selected” to a field. My code:

@select(settingsForm("projectManager"), options(projectManagers), '_label -> "Project manager" )

The HTML result looks like:

<select id="projectManager" name="projectManager">   
    <option value="222">Henk</option>
    <option value="96">Geert</option>
</select>

Does anyone know the scale argument of the @select field to add the select=selected to the html? The result i am looking for looks like:

<select id="projectManager" name="projectManager">   
    <option value="222">Henk</option>
    <option value="96" select="selected">Geert</option>
</select>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T02:19:18+00:00Added an answer on June 3, 2026 at 2:19 am

    After searching the web for some time, my thought went to the sample projects. The answer was there, right in front of me. Creating only the form with a view is not enough! To make this clearer, just look at the computer-database example. To create a empty field, you just pass a Form object to to the view:

    Controller:
    public static Result create() {
        Form<Computer> computerForm = form(Computer.class);
        return ok(
            createForm.render(computerForm)
        );
    }
    
    View:
    @inputText(computerForm("name"), '_label -> "Computer name")
    @inputText(computerForm("introduced"), '_label -> "Introduced date")
    @inputText(computerForm("discontinued"), '_label -> "Discontinued date")
    

    If you want the Form to be filled, you need to pass data to that Form. As the example shows:

     public static Result edit(Long id) {
        Form<Computer> computerForm = form(Computer.class).fill(
            Computer.find.byId(id)
        );
        return ok(
            editForm.render(id, computerForm)
        );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use the new Java 7 Files.createSymbolicLink() method within Play! Framework, and
Hi I installed the new version of the play framework 2.0. Now I am
I am brand new to the Play framework, but I am trying to use
prerequisites: I'm using the latest version of the Play! framework , and the Java
I want to use akka's scheduler in my play 2.0(using java) framework application to
After running a new Play-framework 2.0 based project, i failed to clean it -
I'm new to Play framework. I'm trying to configure MySQL database as a datasource
I'm new to the Entities Framework, and am just starting to play around with
I'd like to create a new project with the Play! framework. My system is
I use play2 to create a default scala app: play new test Then: play

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.