3

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, 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.

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 !!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.