Stay tuned Watch us Facebook Twitter

Thanks! We`ll keep in touch.

Sign up for our Peggy Journal

Get the latest Peggy Forms news, features and great offers!

Name
Email

index

Using HTTP data

PeggyForms has a lot of HTTP/AJAX features. Whether you need data from a public webservice or validation logic from your own business logic, it is all possible. You can populate, validate, base logic and rules on HTTP requests and show information via HTTP requests.

1. Introduction

Lets assume that we want a simple form with a dropdown populated by our webAPI. And we want to display some extra information about our selected item. Just add a dropdown field and an text/information field. First we setup the dropdown with dynamic content:

Datasets form

2. Your HTTP response object

Lets assume that your HTTP request will deliver this JSON result:

{ success: true, myProperty: 105, data: [ { key: 1, label: "My label", body: "My description" }, { key: 2, label: "My label 2", body: "My description 2" }, .. ] }

3. Using a property from your HTTP result object

Now you can access the property myProperty and use it in our textfield. Select your text/information field, go to the content tab and press the Select HTTP field button. In the dialog, choose your property and press Ok. That`s it. If you view your form you`ll see that this value will be replaced with the value in your HTTP response!

If your property is not in the list for some reason, choose 'other' and write a custom property, ie: myProperty.

4. Datasets

If you use HTTP to populate a list or radio buttons, like in this example, you can also use the current dataset as source. If we want, for example, to display the body text in our html/info field, simply press the Select HTTP field button and choose one of the dataset properties, displayed like [*].body.

Selecting the property

The [*]. tells Peggy Forms that we want to access the dataset. From there you can choose the path to your property. In our case, it is [*].body.

5. Result

View form

VIDEO

Learn more about HTTP features

Continue reading