1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Help me how to making a page load itself into a new popup window ???

Discussion in 'Java' started by love4all1080, Mar 6, 2009.

  1. love4all1080

    love4all1080 New Member

    Joined:
    Mar 6, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Hi everyone,

    I need your help.

    I'm sure this is a very simple problem but I can't figure it out.

    Ok, I have a main window where a user fills in a form....


    When submitted it goes onto another page and has two options:

    "remove"

    and

    "attach a picture [choice]"

    When a user clicks on attach a picture it opens up in a pop up window....

    Now what i want it to do is let the user attach a picture and when they click on insert

    the page will load in the main window - the window that had the link to the pop-up - if that makes any sense...

    I had a little bit of Java to close the window, but I want it to close and open the page in the main window...

    If anyone can understand that please help me
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    Check out the Javascript code for the Manage Attachment button code in the New thread / Reply page in this forum
     
  3. love4all1080

    love4all1080 New Member

    Joined:
    Mar 6, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    You have posted in JavaScript forum and I moved it to the Java forum.

    I made the link clickable and you would be able to post links after getting up with your post count.

    Now for the solution you have to fire the event which displays the event in the thumbnail with the param as the url to the image
     
  5. love4all1080

    love4all1080 New Member

    Joined:
    Mar 6, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    no one helped me do :nonod: I need it in a presentation a few days with programming language Java - Desktop Ajax
     
  6. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    You need to do this. Now for the solution you have to fire the event which displays the event in the thumbnail with the param as the url to the image
     
  7. love4all1080

    love4all1080 New Member

    Joined:
    Mar 6, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    In main form i fire the even :
    Code:
    <a href="JavaScript:openWindow('admin_upload.do?dir=products&formTarget=frmAddMobile&elementTarget1=txtImgPre&elementTarget2=imgPre')">
    <img alt="Upload" name="imgPre" border="1" src="<%=eProductDetail.getImage1()%>" width="150" style="border: 1px solid #C0C0C0;">
    </a>
    <input name="txtImgPre" type="hidden" value="<%=eProductDetail.getImage1()%>">
    
    when i click image, new popup window will display and in window popup i request all variables
    Code:
    <%
        String qStrDir=request.getParameter("dir");
        String formTarget=request.getParameter("formTarget");
        String elementTarget1=request.getParameter("elementTarget1");
        String elementTarget2=request.getParameter("elementTarget2");
    %>
    <script language="JavaScript">
    <!--
    function insertPic(strValue){
        window.opener.document.<%=formTarget%>.<%=elementTarget1%>.value=strValue;
        window.opener.document.<%=formTarget%>.<%=elementTarget2%>.src="../images/<%=qStrDir%>/"+strValue;
    }
    </script>
    
    after finished up load i can get file image name
    Code:
    <input onclick="javascript:insertPic('<%=fname%>');window.close();" type="button" value="Insert" name="Close1">
    
    when i click insert only the popup window close but not insert image in main window

    :disappoin:disappoin:disappoin:disappoin:disappoin
     
  8. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    You have this

    window.opener.document.<%=formTarget%>.<%=elementTarget2%>.src="../images/<%=qStrDir%>/"+strValue;

    And check if all the variables are correct.

    or else this can be done simply by using plain JavaScript

    Name the image with some id and then assign the src of that id to the image value

    ../images/<%=qStrDir%>/"+strValue
     

Share This Page