0

Below is my dialogue code and the issue is that when I submit it doesn't show error and it get's closed I want to shoe that error on that form itself. I have used form validation where it doesn't works and it only doesn't work on this particular model

<div class="modal fade" id="modal1" data-open-click="true" data-open-delay="2500" tabindex="-1" role="dialog">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <div class="modal-body">
                <div class="row">
                    <div class="col-md-12">
                        <h2 class="heading"><span class="color2">FEEDBACK </span>FORM</h2>

                        <form role="form" action="<?php echo base_url();?>home/add_record" method="post">
                            <div class="form-group">
                                <label for="contact-name">Name</label>
                                <input name="name" id="<?php if(isset($record[0]['feed_name'])){echo $record[0]['feed_name'];}?>" type="text" class="form-control" value="<?php if(isset($record[0]['feed_name'])){ echo $record[0]['feed_name']; }else{ echo set_value('name'); } ?>">
                                <div class="clearfix"></div>
                                <?php if(form_error('name')!=""){ echo form_error('name');} ?>
                            </div>
                            <div class="form-group">
                                <label for="mobile">Mobile</label>
                                <input name="mobile" id="<?php if(isset($record[0]['feed_mobile'])){echo $record[0]['feed_mobile'];}?>" type="text" class="form-control" value="<?php if(isset($record[0]['feed_mobile'])){ echo $record[0]['feed_mobile']; }else{ echo set_value('mobile'); } ?>">
                            </div>
                            <div class="form-group">
                                <label for="email">Email ID</label>
                                <input name="email" id="<?php if(isset($record[0]['feed_email'])){echo $record[0]['feed_email'];}?>" type="text" class="form-control" value="<?php if(isset($record[0]['feed_email'])){ echo $record[0]['feed_email']; }else{ echo set_value('email'); } ?>">
                                <div class="clearfix"></div>
                                <?php if(form_error('email')!=""){ echo form_error('email');} ?>
                            </div>
                            <div class="form-group">
                                <label for="feedback">Feedback</label>
                                <textarea class="form-control" id="feedback" name="feedback" rows="3"><?php if(isset($record[0]['feed_desc'])){ echo $record[0]['feed_desc']; }else{ echo set_value('feedback'); } ?></textarea>
                            </div>
                            <button type="submit" class="btn btn-success">Submit</button>
                            <a href="<?php echo base_url();?>" class="btn btn-danger"> Cancel </a>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
  • without your javascript, it's impossible to know what's happening, but guess what? If you put a `type=submit`inside a form, it will submit your form by default, so it will send the page action to `home/add_record` – Jordi Flores Feb 22 '17 at 10:04
  • but I want to store the data from the form and without submit how can I do that – Aishwarya Patil Feb 22 '17 at 10:33
  • And I have Used Bootstrap dialogue box – Aishwarya Patil Feb 22 '17 at 10:35
  • you have to use a javascript ajax function. It should call your php page that stores the data and returns a result to your function. So, that will, you don't need to reload the client page. Take a look at this http://stackoverflow.com/questions/5150571/javascript-function-that-returns-ajax-call-data – Jordi Flores Feb 22 '17 at 11:05
  • I am using Code Igniter where I am not able to understand what URL should I give – Aishwarya Patil Feb 22 '17 at 12:15

0 Answers0