CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Post data to a profile form using ajax
Pages: [1]

Author Topic: Post data to a profile form using ajax  (Read 1280 times)

liveforfun

  • Guest
Post data to a profile form using ajax
March 14, 2010, 10:48:25 am
Hi all,

I have a Profile form in CiviCRM.
But what i am looking to do is that i have data on the form on another site, say Site A, and need to post that data to the profile form in civicrm site, say Site B, and redirect to a page on Site A.
The reason why I don't use the standard profile form CiviCRM provides is that I want to keep user stay on Site A when form validation fails or after submitting form.
I have a couple of questions about Profile form.

1. how can I redirect user to a page by providing url after submitting the form?
2. I copied the html snippet to my standalone form. Is there any change I should make to make Ajax call work?
I hope I make my questions clear! Thanks all for any help!

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Post data to a profile form using ajax
March 14, 2010, 11:24:16 am
I guess you can use standalone profile mode and implement validations like required using javascript. Implementing ajax validations might be slightly complex.

Hth

Kurund
Found this reply helpful? Support CiviCRM

liveforfun

  • Guest
Re: Post data to a profile form using ajax
March 14, 2010, 11:57:26 am
Kurund,

thanks a lot.
I found a solution for ajax submit.

The reason why I can't post data to profile form is that when submitting form using jquery ajax function, it does not include the value of submit button.
So I put the following html code to the beginning of my form. And then it works.

<input name="_qf_Edit_next" type="hidden" value="Subscribe" />

But I still have question about redirect url to specific page. Any idea and advice is welcome. Thanks in advance.

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Post data to a profile form using ajax
March 14, 2010, 12:00:55 pm
You can use javascript for redirection.

Kurund
Found this reply helpful? Support CiviCRM

liveforfun

  • Guest
Re: Post data to a profile form using ajax
March 14, 2010, 12:43:45 pm
Kurund,

Thanks a lot for your advice.

I add the following code to ajax callback function and it works.
window.location.replace("myurl");

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Post data to a profile form using ajax

This forum was archived on 2017-11-26.