Answers.Body: <p>As far as I know - If you dont need any specific action to be done on the form which you have created before you hit the submit button then you should be alright </p>
  
  <p>For example: 
  If you enter a Postcode on the form and you need to populate address line of the postcode before submission then you need to write AJAX to fetch the records from Database</p>
  
  <p>Links for civicrm Ajax: references </p>
  
  <p><a href="https://forum.civicrm.org/index.php?topic=28148.0" rel="nofollow">https://forum.civicrm.org/index.php?topic=28148.0</a></p>
  
  <p><a href="https://wiki.civicrm.org/confluence/display/CRMDOC/Ajax+Pages+and+Forms" rel="nofollow">https://wiki.civicrm.org/confluence/display/CRMDOC/Ajax+Pages+and+Forms</a></p>
  
  <p>Also you can find a good example of Ajax used in the below extension </p>
  
  <p><a href="https://civicrm.org/extensions/civicrm-postcode-lookup" rel="nofollow">https://civicrm.org/extensions/civicrm-postcode-lookup</a></p>
  
  <p>I guess this helps !!!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-07T11:23:15.577Z
Answers.LastActivityDate: 2016-09-07T11:23:15.577Z
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Body: <p>For our CiviCRM instance, I use to create forms that allow the user to execute some specific tasks. Typically they end up on a form, they enter some values, and the postProcess function executes some API calls based on what the user entered in the form.</p>
  
  <p>Now I read in the wiki that <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Module+Extension#CreateaModuleExtension-Addabasicwebform" rel="nofollow">the use of forms is discouraged</a>, and that I should use a web page and use Ajax. But I have little experience using javascript in my forms, so I wonder whether there exists some kind of tutorial that shows the best practices for doing this. Or is there a particular existing page in CiviCRM (or an extension) that I can look at? Or maybe someone gave a talk at some Civicon that has been recorded?</p>
  
  <p>Any input is greatly appreciated.</p>
  
Tags: <developer><forms><ajax>
Title: Tutorial for creating pages with ajax
ThreadText: # Tutorial for creating pages with ajax
  
  (Asked by: username_0 on 2016-09-07)
  
  For our CiviCRM instance, I use to create forms that allow the user to execute some specific tasks. Typically they end up on a form, they enter some values, and the postProcess function executes some API calls based on what the user entered in the form.
  
  Now I read in the wiki that [the use of forms is discouraged](https://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Module+Extension#CreateaModuleExtension-Addabasicwebform), and that I should use a web page and use Ajax. But I have little experience using javascript in my forms, so I wonder whether there exists some kind of tutorial that shows the best practices for doing this. Or is there a particular existing page in CiviCRM (or an extension) that I can look at? Or maybe someone gave a talk at some Civicon that has been recorded?
  
  Any input is greatly appreciated.
  
  **Tags:** developer, forms, ajax
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-09-07. Score: 2
  
  As far as I know - If you dont need any specific action to be done on the form which you have created before you hit the submit button then you should be alright
  
  For example:
  If you enter a Postcode on the form and you need to populate address line of the postcode before submission then you need to write AJAX to fetch the records from Database
  
  Links for civicrm Ajax: references
  
  <https://forum.civicrm.org/index.php?topic=28148.0>
  
  <https://wiki.civicrm.org/confluence/display/CRMDOC/Ajax+Pages+and+Forms>
  
  Also you can find a good example of Ajax used in the below extension
  
  <https://civicrm.org/extensions/civicrm-postcode-lookup>
  
  I guess this helps !!!
  
  
  ---
  
  