I have 2 form, Form A as Parent and Form B as iframe form.
Form A, have 1 field entry (id:receiveentry) and 1 button (class:btnopen) to open dialog iframe form. in Form B have 1 field entry (id:entryfield)
scenario is from parent page (form A) i will click on button to open form B as dialogbox, then entry value on entryfield and after close a dialogbox that value from entryfield inform B will come to receiveentry on form A (parent)
this code that i have on form A (parent)
$(document).ready(function () {
// bind click events to launch dialog windows from button
$(".btnopen").click(function(){showDialog(this); return false;});
// define the dialog box
$("#dialogPanelId").dialog({
autoOpen: false,
modal: true,
height: 600,
width: 600,
// zIndex: 100000,
autoOpen: false,
buttons: {
'OK' : function() {
$(this).dialog('close');
}
}
});
});
function showDialog(panel){
$("#dialogPanelId").html('<iframe>').dialog("open") ;
$("#modalIframeId").attr("src","/ufs/ufsmain?formid=FORMB&P1=");
}
======================
Hope someone will help me, many thanks for you all
Regards
Juned
Get Value from iframe form to Parent Form
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 35
- Joined: Mon Jul 14, 2014 11:55 pm
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
-
- Ebase User
- Posts: 35
- Joined: Mon Jul 14, 2014 11:55 pm
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
I'm not that surprised that it doesn't work straight away, but I still think it's the right approach. It can be quite difficult to get client-side Javascript with jQuery working, especially the first time that you do it. The usual symptom is that nothing happens, with no indication of what has gone wrong: unfortunately, this is the nature of Javascript in the browser. You need to try and debug it. Here are some debugging techniques - you need a browser with a debugger, I use Firefox/Firebug but you can use any browser that you are comfortable with:
Simple debugging:
1. Check for Javascript errors using the debug console - Javascript fails silently in the browser so the only symptom is that things stop working
2. If you are calling the server, check the execution log that this has occurred - all calls from the client are logged
3. Put some alerts in your Javascript so you can see how far you're getting
Advanced debugging:
4. Set breakpoints in your Javascript code - check it's working as you expect. In particular check that any passed values are correct. If you're using jQuery to find fields and extract and set values, make sure the field is being found correctly. jQuery will not issue any errors - it will just not do anything. You can use the debugger to evaluate a Javascript statement and check it works as you expect.
If you still can't get it working, post all the details here, and maybe someone will be able to spot what's wrong.
Regards
Jon
Simple debugging:
1. Check for Javascript errors using the debug console - Javascript fails silently in the browser so the only symptom is that things stop working
2. If you are calling the server, check the execution log that this has occurred - all calls from the client are logged
3. Put some alerts in your Javascript so you can see how far you're getting
Advanced debugging:
4. Set breakpoints in your Javascript code - check it's working as you expect. In particular check that any passed values are correct. If you're using jQuery to find fields and extract and set values, make sure the field is being found correctly. jQuery will not issue any errors - it will just not do anything. You can use the debugger to evaluate a Javascript statement and check it works as you expect.
If you still can't get it working, post all the details here, and maybe someone will be able to spot what's wrong.
Regards
Jon
0 x
-
- Ebase Staff
- Posts: 89
- Joined: Mon Sep 10, 2007 11:48 am
Hi Juned,
Three things:
1. You need to give your iFrame an ID when you open it, e.g.
that way the next line:
will be able to find it.
2. Make sure you have both jQuery and JQueryUI in your list of web resources, e.g. from CDN
3. Make sure you have your client script in the web resources list too.
Do these and your form will work fine.
Cheers,
Dave
Three things:
1. You need to give your iFrame an ID when you open it, e.g.
Code: Select all
$("#dialogPanelId").html('<iframe> id="modalIframeId"').dialog("open") ;
Code: Select all
$("#modalIframeId").attr("src","/ufs/ufsmain?formid=FORMB&P1=");
2. Make sure you have both jQuery and JQueryUI in your list of web resources, e.g. from CDN
Code: Select all
http://code.jquery.com/jquery-latest.min.js
http://code.jquery.com/ui/1.10.2/jquery-ui.js
Do these and your form will work fine.
Cheers,
Dave
0 x
-
- Ebase User
- Posts: 35
- Joined: Mon Jul 14, 2014 11:55 pm
-
- Ebase User
- Posts: 35
- Joined: Mon Jul 14, 2014 11:55 pm
-
- Ebase Staff
- Posts: 89
- Joined: Mon Sep 10, 2007 11:48 am
Hi Juned,
A few thoughts:
You may find it easier to use jQuery syntax rather than native JavaScript, especially as you have the jQuery library linked in for the Dialog stuff anyway, e.g.
etc.
Also, you may wish to trigger processing to happen when your Dialog window is closed by the user. You can pick this up using, e.g.
Last thing, the mechanism that Jon was referring to in earlier post is also worth thinking about, i.e. where you call a Javascript function defined on the parent window, which calls Xi server-side processing via the client API. Particularly useful, for example, if you bind the function to the dialogclose event (see above) - this can give you a lot of control over any processing that you want to do.
Dave
A few thoughts:
You may find it easier to use jQuery syntax rather than native JavaScript, especially as you have the jQuery library linked in for the Dialog stuff anyway, e.g.
Code: Select all
$('inputid_on_parent_form').val($('inputid_on_iframe_form').val());
Also, you may wish to trigger processing to happen when your Dialog window is closed by the user. You can pick this up using, e.g.
Code: Select all
$('#dialogPanelId').bind('dialogclose', function(event) {your code});
Dave
0 x
-
- Ebase User
- Posts: 35
- Joined: Mon Jul 14, 2014 11:55 pm
Who is online
Users browsing this forum: No registered users and 27 guests