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

[eluser]ranjitbd[/eluser]
Code:
// 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.....

[removed]
function bookingEditSubmit()
  {
     document.getElementById("booking_details").action = '<?php echo BASEURL?>admin/admin/confirm_booking.html';
     document.getElementById("booking_details").submit();
  }  
[removed]


<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

&lt;/form&gt;

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

El Forum

[eluser]danmontgomery[/eluser]
And the javascript errors are...

El Forum

[eluser]walrusk[/eluser]
I suspect this may help solve your problem.

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

El Forum

[eluser]Unknown[/eluser]
@SummerStudent:

Thanks for sharing that <a href="http://www.spiration.co.uk/post/1232/Submit">link</a>, saved me some hair pulling!

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