-1

I have one form data.php with following form structure.

 <div id="form-container" style="padding-top: 10px; padding-bottom: 10px;">

  var x=Math.random();;
  if(x > 0.5)
  {
      submit form
  } 


 <p style="width: 100%; text-align: right;"><button type="button" id="submit-button">Sumit</button></p>

How form can be automatically submitted based on x value? Which means button should be pressed automatically.

Manish
  • 3,341
  • 15
  • 52
  • 87
  • You need to use javascript (or jquery). Take a look [here:](http://stackoverflow.com/questions/9855656/how-to-submit-a-form-using-javascript) – Michel Jan 25 '15 at 14:14
  • You mean that right when someone enters any value (Or a specific value) into X it should submit the form? – morha13 Jan 25 '15 at 14:17
  • @MorHaviv yes it should be automatically submitted when some enter x value. – Manish Jan 25 '15 at 19:46

1 Answers1

1

document.getElementById('theForm').submit();

Nada N. Hantouli
  • 1,310
  • 1
  • 12
  • 20