0

I have a form with around 500 lines of code and using codeigniter php method, and I have this drop down menu which needs the form to be submitted for the function inside the drop down menu to work.

This is the drop down menu which uses js to open up and submit a picture

<div class="form-group">
          <label class="col-md-4 control-label "><?php echo lang("id_document");?></label>
           <div class="col-md-6 tableCA1 ">
              <div  class="input-group-btn">
              <button type="button" class="btn  certificatebtn btnwithAmazingbrdr " data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <?php echo lang("add_cert");?>
              <span class="glyphicon glyphicon-paperclip" id="pushingPaperClip"></span> 
              </button>
              <ul class="dropdown-menu text-left">
                <li><a href="#" data-bind="click: showModalAddId"><?php echo lang("myprofile_riskrating_add_certificate"); ?></a></li>
                <li><a href="#" data-bind="click: showModalShowId"><?php echo lang("myprofile_riskrating_show_certificate"); ?></a></li>
                <li><a href="#" data-bind="visible: userIsImpersonated(), click: showModalUserValidation"><?php echo lang("myprofile_riskrating_verify_certificate"); ?></a></li>
              </ul>
              <!-- <img width='34' height='34' id = "myid" data-bind="popUp: {tocall: $root.showModalShowPicture}" /> -->
            </div>
            </div>

        </div>

but I have a error for submitting the picture since the form is not submitted. What I want to do is submit the form which includes name , birthday, etc, and open this drop down model at the same time, but without reloading the page on submit so the drop down menu open. I know AJAX is a way of doing it but I have way to many code in php to write them again in ajax, and will have to change a lot of things in controller since I am using codeigniter.

This is how the form is being submitted.

/* form-horizontal */
    $attributes = array("class" => "form-horizontal", "id" => "register_form");

    if (isset($_SESSION['login'])) 
    {
        if ($_SESSION['login'] == 'DoBusinessPerformed' || $_SESSION['login'] == 'NormalPerformed') {                
            echo form_open('myprofile/ManageProcessNew/'.$pathName, $attributes);
        } else {
            echo form_open('myprofile/RegisterProcessNew/'.$pathName, $attributes);
        }
    } 
    else 
    {
        echo form_open('myprofile/RegisterProcessNew/'.$pathName, $attributes); 
    }    

So is there anyway I can submit the form on the background if I click the drop down button.

XAF
  • 1,442
  • 1
  • 9
  • 18
  • You can by using ajax – ka_lin Aug 04 '16 at 09:23
  • @ka_lin in the whole post i wrote i do not want to use ajax... – XAF Aug 04 '16 at 09:25
  • 1
    Then post it to an iframe...or use black magic – ka_lin Aug 04 '16 at 09:27
  • really dont want to use black magic, but if you can tell me how its done with iframe would be great :) – XAF Aug 04 '16 at 09:28
  • http://stackoverflow.com/questions/168455/how-do-you-post-to-an-iframe although the other option could be more fun, happy coding :) – ka_lin Aug 04 '16 at 09:29
  • i saw the example, but i am not understanding how the iframe works exactly, and how do I use it form_open, and on click submission of the drop down menu @ka_lin – XAF Aug 04 '16 at 09:34
  • You can use angular js with codeigniter . Demo URL : http://itsolutionstuff.com/post/codeigniter-3-and-angularjs-crud-with-search-and-pagination-exampleexample.html – Rax Shah Aug 04 '16 at 12:43

0 Answers0