How to submit from in iframe and redirect parent page on click submit button on iframe Modal form page?

Please I have a web code assignment to solve. Detailed information is highlighted Below:

Assignment is based on submitting iframe web form input to database and redirecting parent web page on click submit button on modal iframe web form.

I haven’t tried any possible solution because it’s out of my depth

Iframe Code Tag on Parent page:

<iframe src="http://127.0.0.1/cms/v/index.php/fm/frontend/viewform/?form=1&lmode=1" scrolling="no" frameborder="0" style="border:none;width:100%;" allowTransparency="true"></iframe><script type="text/javascript"> var UIFORM_SRC = "http://127.0.0.1/cms/v/"; (function() { var uiform = document.createElement('script'); uiform.type = 'text/javascript'; uiform.async = true; uiform.src = ('https:' == document.location.protocol ? UIFORM_SRC : UIFORM_SRC) + 'assets/frontend/js/iframe.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(uiform, s); })();</script>

Associated Ajax:

{"app_ver":"","main":{"submit_ajax":"1","add_css":"","add_js":"","onload_scroll":"1","preload_noconflict":"1","pdf_charset":"UTF-8","pdf_font":"2","pdf_show_onpage":"1"},"skin":{"form_width":{"show_st":"0","max":"800"},"form_padding":{"show_st":"1","pos_top":"20","pos_right":"17","pos_bottom":"20","pos_left":"17"},"form_background":{"show_st":"0","type":"1","start_color":"#eeeeee","end_color":"#ffffff","solid_color":"#eeeeee","image":""},"form_border_radius":{"show_st":"0","size":"5"},"form_border":{"show_st":"0","color":"#000","style":"1","width":"1"},"form_shadow":{"show_st":"0","color":"#CCCCCC","h_shadow":"3","v_shadow":"3","blur":"10"}},"wizard":{"enable_st":"0","tabs":[{"title":"Tab title 1"}],"theme_type":"0","theme":[{"skin_tab_cur_bgcolor":"#4798E7","skin_tab_cur_txtcolor":"#ffffff","skin_tab_cur_numtxtcolor":"#4798E7","skin_tab_inac_bgcolor":"#ECF0F1","skin_tab_inac_txtcolor":"#95A5A6","skin_tab_inac_numtxtcolor":"#ECF0F1","skin_tab_done_bgcolor":"#9a8afa","skin_tab_done_txtcolor":"#ffffff","skin_tab_done_numtxtcolor":"#ECF0F1","skin_tab_cont_bgcolor":"#F9F9F9","skin_tab_cont_borcol":"#D4D4D4"},{"skin_tab_cur_bgcolor":"#4798E7","skin_tab_cur_txtcolor":"#000000","skin_tab_cur_numtxtcolor":"#4798E7","skin_tab_cur_bg_numtxt":"#ffffff","skin_tab_inac_bgcolor":"#cccccc","skin_tab_inac_txtcolor":"#95A5A6"}]},"onsubm":{"sm_successtext":"%3Cdiv%20class%3D%22rockfm-alert%20rockfm-alert-success%22%3ESuccess!%20Form%20was%20sent%20successfully.%3C%2Fdiv%3E","sm_boxmsg_bg_st":"0","sm_boxmsg_bg_type":"1","sm_boxmsg_bg_solid":"","sm_boxmsg_bg_start":"","sm_boxmsg_bg_end":"","sm_redirect_st":"0","sm_redirect_url":"","mail_from_email":"vfms@gmail.com","mail_from_name":"Here goes your From Name","mail_template_msg":"%3Cdiv%20align%3D%22center%22%3E%0A%3Ctable%20style%3D%22background%3A%20%23daf1f8%3B%20border%3A%201px%20solid%20%23000000%3B%22%20border%3D%220%22%20width%3D%22600%22%20cellspacing%3D%225%22%20cellpadding%3D%225%22%3E%0A%3Ctbody%3E%0A%3Ctr%3E%0A%3Cth%20style%3D%22background-color%3A%20%2391c5f2%3B%22%3ENew%20form%20request%3C%2Fth%3E%0A%3C%2Ftr%3E%0A%3Ctr%3E%0A%3Ctd%20style%3D%22text-align%3A%20left%3B%22%20valign%3D%22top%22%3EYou%20are%20receiving%20a%20new%20form%20request%3A%3Cbr%20%2F%3E%20%3Cbr%20%2F%3E%20%5Buifm_var%20opt%3D%22rec_summ%22%5D%3C%2Ftd%3E%0A%3C%2Ftr%3E%0A%3Ctr%3E%0A%3Ctd%20style%3D%22text-align%3A%20left%3B%22%3EForm%20information%3A%3Cbr%20%2F%3E%20URL%3A%5Buifm_var%20opt%3D%22rec_url_fm%22%5D%3Cbr%20%2F%3E%20Form%3A%20%5Buifm_var%20opt%3D%22form_name%22%5D%3C%2Ftd%3E%0A%3C%2Ftr%3E%0A%3C%2Ftbody%3E%0A%3C%2Ftable%3E%0A%3C%2Fdiv%3E","mail_recipient":"vfms@gmail.com","mail_cc":"","mail_bcc":"","mail_subject":"Here goes your subject mail","mail_usr_st":"0","mail_usr_template_msg":"%3Cdiv%20align%3D%22center%22%3E%0A%3Ctable%20style%3D%22background%3A%20%23daf1f8%3B%20border%3A%201px%20solid%20%23000000%3B%22%20border%3D%220%22%20width%3D%22600%22%20cellspacing%3D%225%22%20cellpadding%3D%225%22%3E%0A%3Ctbody%3E%0A%3Ctr%3E%0A%3Cth%20style%3D%22background-color%3A%20%2391c5f2%3B%22%3ENew%20form%20request%3C%2Fth%3E%0A%3C%2Ftr%3E%0A%3Ctr%3E%0A%3Ctd%20style%3D%22text-align%3A%20left%3B%22%20valign%3D%22top%22%3EYou%20are%20receiving%20a%20new%20form%20request%3A%3Cbr%20%2F%3E%20%3Cbr%20%2F%3E%20%5Buifm_var%20opt%3D%22rec_summ%22%5D%3C%2Ftd%3E%0A%3C%2Ftr%3E%0A%3Ctr%3E%0A%3Ctd%20style%3D%22text-align%3A%20left%3B%22%3EForm%20information%3A%3Cbr%20%2F%3E%20URL%3A%5Buifm_var%20opt%3D%22rec_url_fm%22%5D%3Cbr%20%2F%3E%20Form%3A%20%5Buifm_var%20opt%3D%22form_name%22%5D%3C%2Ftd%3E%0A%3C%2Ftr%3E%0A%3C%2Ftbody%3E%0A%3C%2Ftable%3E%0A%3C%2Fdiv%3E","mail_usr_pdf_st":"0","mail_usr_pdf_charset":"UTF-8","mail_usr_pdf_template_msg":"%3Cdiv%20align%3D%22center%22%3E%0A%3Ctable%20style%3D%22background%3A%20%23daf1f8%3B%20border%3A%201px%20solid%20%23000000%3B%22%20border%3D%220%22%20width%3D%22600%22%20cellspacing%3D%225%22%20cellpadding%3D%225%22%3E%0A%3Ctbody%3E%0A%3Ctr%3E%0A%3Cth%20style%3D%22background-color%3A%20%2391c5f2%3B%22%3ENew%20form%20request%3C%2Fth%3E%0A%3C%2Ftr%3E%0A%3Ctr%3E%0A%3Ctd%20style%3D%22text-align%3A%20left%3B%22%20valign%3D%22top%22%3EYou%20are%20receiving%20a%20new%20form%20request%3A%3Cbr%20%2F%3E%20%3Cbr%20%2F%3E%20%5Buifm_var%20opt%3D%22rec_summ%22%5D%3C%2Ftd%3E%0A%3C%2Ftr%3E%0A%3Ctr%3E%0A%3Ctd%20style%3D%22text-align%3A%20left%3B%22%3EForm%20information%3A%3Cbr%20%2F%3E%20URL%3A%5Buifm_var%20opt%3D%22rec_url_fm%22%5D%3Cbr%20%2F%3E%20Form%3A%20%5Buifm_var%20opt%3D%22form_name%22%5D%3C%2Ftd%3E%0A%3C%2Ftr%3E%0A%3C%2Ftbody%3E%0A%3C%2Ftable%3E%0A%3C%2Fdiv%3E","mail_usr_pdf_fn":"attachment-pdf-%5Buifm_var%20opt%3D%22rec_id%22%5D","mail_usr_recipient":"","mail_usr_cc":"","mail_usr_bcc":"","mail_usr_subject":"Here goes your subject mail"},"num_tabs":"1","steps":{"tab_title":[{"title":"Tab title 1"}],"tab_cont":[{"content":[{"iscontainer":"0","num_tab":"0","type":"6","id":"uiulge9qr9o"},{"iscontainer":"0","num_tab":"0","type":"15","id":"uip91giq9h5"},{"iscontainer":"0","num_tab":"0","type":"40","id":"uiwjqjzsszr"},{"iscontainer":"0","num_tab":"0","type":"20","id":"ui9h6ej2ab8"}]}]},"steps_src":[{"uiulge9qr9o":{"type":"6","id":"uiulge9qr9o","skin":[],"field_name":"usrid","order_frm":"1","type_n":"textbox","input":{"value":"","size":"18","bold":"0","italic":"0","underline":"0","placeholder":"User ID","color":"#000","font":"{\"family\":\"Helvetica, Arial, sans-serif\",\"name\":\"Helvetica\",\"classname\":\"helvetica\"}","font_st":"1","val_align":""},"label":{"text":"","size":"8","bold":"0","italic":"0","underline":"0","color":"#000","font":"{\"family\":\"Helvetica, Arial, sans-serif\",\"name\":\"Helvetica\",\"classname\":\"helvetica\"}","font_st":"1","shadow_st":"0","shadow_color":"#666","shadow_x":"1","shadow_y":"1","shadow_blur":"3"},"sublabel":{"text":"","size":"8","bold":"1","italic":"1","underline":"0","color":"#000","font":"{\"family\":\"'Comic Sans MS', Arial, sans-serif\",\"name\":\"Comic Sans MS\",\"classname\":\"comicsansms\"}","font_st":"1","shadow_st":"0","shadow_color":"#666","shadow_x":"1","shadow_y":"1","shadow_blur":"3"},"txt_block":{"block_pos":"1","block_st":"1","block_align":"0"},"el_background":{"show_st":"1","type":"1","start_color":"","end_color":"","solid_color":"#f2f4f5"},"el_border_radius":{"show_st":"1","size":"3"},"el_border":{"show_st":"1","color":"#b1b9bf","color_focus_st":"1","color_focus":"#0272b6","style":"1","width":"1"},"help_block":{"text":"here your content","show_st":"0","font":"","font_st":"0","pos":""},"validate":{"typ_val":"5","typ_val_custxt":"","pos":"0","tip_col":"#000000","tip_bg":"#ffffff","reqicon_st":"0","reqicon_pos":"0","reqicon_img":"glyphicon-asterisk"},"clogic":{"show_st":"0","f_show":"1","f_all":"1","list":[]}},"uip91giq9h5":{"type":"15","id":"uip91giq9h5","skin":[],"field_name":"pin","order_frm":"2","type_n":"pin","input":{"value":"","size":"14","bold":"0","italic":"0","underline":"0","placeholder":"","color":"#000","font":"","font_st":"1","val_align":""},"label":{"text":"","size":"8","bold":"0","italic":"0","underline":"0","color":"#000","font":"{\"family\":\"'Comic Sans MS', Arial, sans-serif\",\"name\":\"Comic Sans MS\",\"classname\":\"comicsansms\"}","font_st":"1","shadow_st":"0","shadow_color":"#666","shadow_x":"1","shadow_y":"1","shadow_blur":"3"},"sublabel":{"text":"","size":"8","bold":"0","italic":"0","underline":"0","color":"#000","font":"{\"family\":\"'Comic Sans MS', Arial, sans-serif\",\"name\":\"Comic Sans MS\",\"classname\":\"comicsansms\"}","font_st":"1","shadow_st":"0","shadow_color":"#666","shadow_x":"1","shadow_y":"1","shadow_blur":"3"},"txt_block":{"block_pos":"1","block_st":"1","block_align":"0"},"el_background":{"show_st":"1","type":"1","start_color":"","end_color":"","solid_color":"#f2f4f5"},"el_border_radius":{"show_st":"1","size":"3"},"el_border":{"show_st":"1","color":"#b1b9bf","color_focus_st":"1","color_focus":"#0272b6","style":"1","width":"1"},"help_block":{"text":"here your content","show_st":"0","font":"","font_st":"0","pos":""},"validate":{"typ_val":"5","typ_val_custxt":"","pos":"0","tip_col":"#000000","tip_bg":"#ffffff","reqicon_st":"0","reqicon_pos":"0","reqicon_img":"glyphicon-asterisk"},"clogic":{"show_st":"0","f_show":"1","f_all":"1","list":[]}},"uiwjqjzsszr":{"type":"40","id":"uiwjqjzsszr","skin":[],"field_name":"stysn","order_frm":"3","type_n":"switch","input15":{"txt_yes":"Yes","txt_no":"No"},"price":{"enable_st":"1","lbl_show_st":"1","lbl_show_format":"%3Cp%3E(%5Buifm_symbol%5D%20%5Buifm_price%5D%20%5Buifm_currency%5D)%3C%2Fp%3E","color":"#FF0000","font":"{\"family\":\"'Comic Sans MS', Arial, sans-serif\",\"name\":\"Comic Sans MS\",\"classname\":\"comicsansms\"}","font_st":"1","unit_price":"1"},"label":{"text":"Get in","size":"16","bold":"0","italic":"0","underline":"0","color":"#000","font":"{\"family\":\"Open Sans\",\"name\":\"Open Sans\",\"import_family\":\"Open+Sans:300,300italic,regular,italic,600,600italic,700,700italic,800,800italic\",\"classname\":\"opensans\",\"png_url\":\"opensans-regular.png\"}","font_st":"1","shadow_st":"0","shadow_color":"#666","shadow_x":"1","shadow_y":"1","shadow_blur":"3"},"sublabel":{"text":"","size":"14","bold":"1","italic":"1","underline":"0","color":"#000","font":"{\"family\":\"Open Sans\",\"name\":\"Open Sans\",\"import_family\":\"Open+Sans:300,300italic,regular,italic,600,600italic,700,700italic,800,800italic\",\"classname\":\"opensans\",\"png_url\":\"opensans-regular.png\"}","font_st":"1","shadow_st":"0","shadow_color":"#666","shadow_x":"1","shadow_y":"1","shadow_blur":"3"},"txt_block":{"block_pos":"2","block_st":"1","block_align":"1"},"help_block":{"text":"here your content","show_st":"0","font":"","font_st":"0","pos":""},"clogic":{"show_st":"0","f_show":"1","f_all":"1","list":[]}},"ui9h6ej2ab8":{"type":"20","id":"ui9h6ej2ab8","skin":[],"field_name":"","order_frm":"4","type_n":"submitbtn","input":{"value":"Submit","size":"18","bold":"0","italic":"0","underline":"0","color":"#ffffff","font":"{\"family\":\"Open Sans\",\"name\":\"Open Sans\",\"import_family\":\"Open+Sans:300,300italic,regular,italic,600,600italic,700,700italic,800,800italic\",\"classname\":\"opensans\",\"png_url\":\"opensans-regular.png\"}","font_st":"1","val_align":"","obj_align":"1","placeholder":""},"label":{"text":"","size":"8","bold":"0","italic":"0","underline":"0","color":"#000","font":"{\"family\":\"Open Sans\",\"name\":\"Open Sans\",\"import_family\":\"Open+Sans:300,300italic,regular,italic,600,600italic,700,700italic,800,800italic\",\"classname\":\"opensans\",\"png_url\":\"opensans-regular.png\"}","font_st":"1","shadow_st":"0","shadow_color":"#666","shadow_x":"1","shadow_y":"1","shadow_blur":"3"},"sublabel":{"text":"","size":"8","bold":"1","italic":"1","underline":"0","color":"#000","font":"{\"family\":\"Open Sans\",\"name\":\"Open Sans\",\"import_family\":\"Open+Sans:300,300italic,regular,italic,600,600italic,700,700italic,800,800italic\",\"classname\":\"opensans\",\"png_url\":\"opensans-regular.png\"}","font_st":"1","shadow_st":"0","shadow_color":"#666","shadow_x":"1","shadow_y":"1","shadow_blur":"3"},"txt_block":{"block_pos":"0","block_st":"0","block_align":"0"},"el_background":{"show_st":"1","type":"2","start_color":"#0272b6","end_color":"#0272b6","solid_color":"#ffffff"},"el_border_radius":{"show_st":"1","size":"50"},"el_border":{"show_st":"1","color":"#0272b6","color_focus_st":"1","color_focus":"#0272b6","style":"1","width":"3"},"help_block":{"text":"here your content","show_st":"0","font":"","font_st":"0","pos":""},"clogic":{"show_st":"0","f_show":"1","f_all":"1","list":[]}}}]}

Form Submit button in modal page::

<div class="rockfm-input-container">
<button data-uifm-tabnum="0" class="rockfm-txtbox-inp-val btn" type="submit" data-val-btn="Sign in" data-val-subm="Sending" onclick="javascript:rocketfm.submitForm(this);return false;">Sign in</button>
</div>

Submitting iframe web form input to database and redirecting parent web page on click submit button on modal iframe web form

parent.location.reload()

Please can you give me a sample code that solve the problem. I want to redirect the parent page to another web page on click of submit button in the iframe or child page

No, I will not do your homework for you.

1 Like

Its not a school assignment lol. Please help me. I need proper application of the code. I will most appreciate if you can solve this for me. Thank you in advance