CodeIgniter Forums

Full Version: form submit not working with javascript
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

// i have a form but two input buttons. one is type="submit" another is type="button"
// when i click the button i set a javascript function for submit the form but its not working.....

function bookingEditSubmit()
     document.getElementById("booking_details").action = '<?php echo BASEURL?>admin/admin/confirm_booking.html';

<form name="booking_details" id="booking_details" action ="<?php BASEURL?>admin/admin/confirm_booking.html">

// some input field is here
// i can solved it by using <a href="">...but i need the input value of the form
// actually i have to submit this form in different controller with input data

&lt;input type="submit" name="submit" id="submit" value="Confirm"&gt; // this tag working fine
&lt;input type="button" name="submit_edit" id="submit_edit" value="Edit Confirm"&gt;  // this button showing javascript errors


// so what is the solution for submit a page with javascript

El Forum

And the javascript errors are...

El Forum

I suspect this may help solve your problem.

EDIT: or perhaps not since you posted this ages ago... :/

El Forum


Thanks for sharing that <a href="">link</a>, saved me some hair pulling!

Only needed to rename my custom submit button, and submit() worked.