TOPIC:

API call 1 year 3 months ago #244212

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 808
Hi,

I just realized you actually seem to need fields from the form.

"Before Form" happens on form render, not on submission and since there are no values yet at this point, this error will be returned.

I think that was my fault because I hadn't your requirement in mind. Sorry for that.

So please restore your code back into the submit piece, so the API call works again.

In the end of that submit piece code add this to store the response in a session variable:
JFactory::getSession()->set('response', $response); // assuming $response is the actual response from the service

Then in the before form piece, add this (just this):
echo '
<script>
JQuery(document).ready(function(){

   ff_getElementByName("response").value = ' . json_encode( JFactory::getSession()->get('response', '') ) . ';
});
</script>
';

With this you should always get the last response retrieved from your api call as soon as the form loads.

Regards,
Markus

Please Log in or Create an account to join the conversation.

API call 1 year 3 months ago #244273

  • Topic Author
  • gtgt
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 64
  • Thanks: 1
Still not working.

API call sent, answer arrived, but cannot shown or loaded.

Please Log in or Create an account to join the conversation.

API call 1 year 3 months ago #244276

  • Topic Author
  • gtgt
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 64
  • Thanks: 1
Dear Markus,

I hava a TEXTFIELD element named APIresponse. This is located after the required fields, so when user click on APIresponse element the info for the API has already enteres to the form.


I think an action script on APIresponse click should send the API call and put the response to the value of the APIresponse textfield element.

Please Log in or Create an account to join the conversation.

API call 1 year 3 months ago #244349

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 808
ok, but then the entire workflow will change. you basically will need to implement an ajax call using the action script. the ajax call will then have to call the form url with a parameter like "request_api=true" in the before form piece.

The before form piece will have to listen to this request parameter and execute the api call and printing the results.

In order for this to work, the form piece will also have to stop rendering the page using exit; in the end and an ob_end_clean() to suppress previously rendered contents.

Do you feel you can implement it? There are examples in the forums on how to ajax calls in action scripts.

Regards,
Markus

Please Log in or Create an account to join the conversation.

API call 1 year 3 months ago #244350

  • Topic Author
  • gtgt
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 64
  • Thanks: 1
Dear Markus,

I would need a solution for this. I am behind the deadline.
We are close to the solution, but we need 10-15 minutes support to finalise.
Can we put a bit more focus on this issue?

I have lifetime subscription, but I am open minded to pay fee for the support.

Thanks

Please Log in or Create an account to join the conversation.

API call 1 year 3 months ago #244367

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 808
Can you please export your current form and attach it here?
When you export, please only choose your form in BF => Config => Create Package, nothing else.

Please Log in or Create an account to join the conversation.

Last edit: Post by TheMuffinMan.
Moderators: ForumSupport
Time to create page: 0.050 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!