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 8810497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:07:59+00:00 2026-06-14T03:07:59+00:00

I have an HTML form field that is going to take the url for

  • 0

I have an HTML form field that is going to take the url for an image of mine. I have (in a different section of my site) a media library where users can opload and organize their images.
Now I want to be able to open this media library either in a new window (easier for me, but don’t know how I would then populate the form field in the mother window with a script from a new window, method not allowed?) or by reading the media library into a div (more troublesome since I’d have to rewrite much of the media library navigation to not refresh the page but only that div).

I have never done this so I was thinking maybe someone seasoned could give me a hint and start me off in the right direction.

  • 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-14T03:08:01+00:00Added an answer on June 14, 2026 at 3:08 am

    I ended up using jQuery modal dialogue with an Iframe inside, and upon click of an image the input field gets populated and the dialogue is closed.

    Some sample code if it can be an inspiration to anyone…

    Here is my input box with a browse button

    <input type='text' name='data_1' id='data_1' size='30' value='' /> <input type='button' value='Bläddra' onclick="openMediaLibrary('data_1');" />
    

    This is somewhere on the form page (hidden by default)

    <div id="mediaLibrary" title="Mediabiblioteket">
        <iframe width="1050px" height="600px" src="{{ path('Media') }}" /></iframe>
    </div>
    

    Here is a sample of an image in the mediaLibrary

    <a href="javascript:selectImage('{{ entity.webPath }}')"><img src="{{ entity.webPath | apply_filter('my_thumb') }}" class="media_archive_image" /></a>
    

    Here are my functions for initializing, opening and closing the mediaLibrary

    $(document).ready(function() {
            $( "#mediaLibrary" ).dialog({
            height: 700,
            width:1100,
            modal: true,
            autoOpen: false,
            position: { my: "center", at: "center" },
        });
    };
    
    function openMediaLibrary(passedField) {
        //Set the variable that keeps track of which field to pass back the image url to
        window.imageInputField = passedField
        //open the mediaLibrary
        $( "#mediaLibrary" ).dialog( "open" );
    }   
    
    function closeMediaLibrary() {
        $( "#mediaLibrary" ).dialog( "close" );
    }   
    

    And finally the functions for assigning the image and closing the mediaLibrary

    function selectImage(image) {
    
        if (parent.window.imageInputField) {
            //set image to the input field
            parent.window.document.getElementById(parent.window.imageInputField).value = image;
    
            //Close the dialogue box
            parent.window.closeMediaLibrary();
    
        }
        else {
            //do nothing for now, perhaps show image in fullsize in lightbox here?
        }
    }   
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a HTML form that has certain fields which i am opening inside
We have got an extjs 3.1.1 form with file upload field ( http://www.extjs.com/deploy/dev/examples/form/file-upload.html from
I have a form with different html input fields... 1) <input type=text> 2) <textarea></textarea>
I have a following problem, I have HTML form that uploads a file with
I currently have a relatively large HTML form (100+ fields). I want to take
I have a HTML form with fields such as name, address, notes, etc. I
I have a simple html form with few fields in it. I wanted to
I have just a basic html form within index.php which contains two text fields:
I had developed one website purely in HTML .I have my form with fields
When you have an ASP.Net MVC form created by Html.BeginForm(), how do fields inside

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.