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

  • Home
  • SEARCH
  • 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 8801041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:44:21+00:00 2026-06-14T00:44:21+00:00

The problem I have is best explained with a code example: I have the

  • 0

The problem I have is best explained with a code example:

I have the following VIEW.jsp:

<c:forEach var="widget" items="${widgets}">
        <div class="drag">
             <p>Id: ${widget.id}</p>
             <input class="editWidget" type="image" src="/tis/img/icons/edit.png" alt="Edit widget">
             <input class="idWidget" type="hidden" value="${widget.id}">
        </div>
</c:forEach>

<div id="editDialog" title="Edit widget">
    <fieldset>
         <input class="editWidgetId" type="hidden" value="??" id="editWidgetId">
    </fieldset>
</div>

editWidgetId should have its ‘value’ attribute filled with the value of idWidget inside the foreach loop. This value should be different for each element in the loop (element is selected by edit button).

The questions:

  1. How can I get the value of one input field to another input field?
  2. How can I do this when a foreach loop is present?

Thanks in advance

  • 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-14T00:44:22+00:00Added an answer on June 14, 2026 at 12:44 am

    Given you want dynamic behavior, this work has to be executed on the client-side by JavaScript as at the server-side, you have many widgets to one editDialog and are lacking the client-side user event to make your decision.

    What you want to do is assign a function handler (or statement in my example below) to each editWidget to change the value of the editWidgetId input box with the appropriate value:

    <input onclick="document.getElementById('editWidgetId').value = '${widget.id}'" class="editWidget" type="image" src="/tis/img/icons/edit.png" alt="Edit widget" >
    

    Haven’t tested this but I hope you get the idea

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The best way to explain my problem is by a example. I have a
My problem is to find best view configuration for my application that have a
Best to use an example to describe the problem. Lets say I have a
I'm looking for the generally accepted/best solution to this problem. Problem I have a
I've got a problem I'm not sure how best to solve. I have an
I am trying to work out the best practice for my problem. I have
Excuse the title, but it's best I just explain the problem. I have 2
I think the issue is explained best with an example. public class MyService {
I have the following code which seems to work OK except for a minor
I have a Java code with the following pattern: enum Foo { ORANGE, APPLE,

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.