Processing forms


(Mario Magalhaes) #1

I am building for a client a kind of calcular:

  • The calculator presents a form with four text input fields
  • The user fills any two out of four text fields with numbers (validate by regular expressions).
  • The user clicks on a button “calculate”
  • The calculator presents the same four text fields with coherent calculate values
  • The user can: delete any two values, change the others or clean all of them and restart.

The old version was built directly on html and php - using “isset php function”, php $_POST to test and assigning php variables, and presenting calculated values through variables in the text input fields in a form. Quite HTML / PHP text book approach.

Now using Rapidweaver / Stacks 3 / Foundation_stack_full_package how can I build an equivalent solution? I have html stack to include the php code but:

  • How to assign received $_ POST values to text input fields in the form stack
  • How to post the input values to call the calculator ?
  • Using form button option POST I can call a URL, but how to include the text field values?
  • Is it not possible to call a page and send values using set link/Custom Attributes?
  • Is there any demo, model or tutorial about?

(Mario Magalhaes) #2

The whole question boils down to three topics:
(two of them solved, thanks Ben)

  1. ok - Receiving a value through the page URL - what can be accomplished by some PHP code in a HTML stack t using _POST or _GET ou $_REQUEST

  2. ok - Assign a value for a text field in a foundation stack form - what can be accomplished using the text field default value using also some PHP Code such as <?php echo $variable ?>

  3. ?? - How to use the the value (provided by the user) in a text stack in a foundation stack form in the link to “Redirect on Success” or to “Custom POST Address”??

This last question is still open for me.

If it was to send a e-mail as the action of the form, the Email Setup form can manage the form fields using {{Field Name}} in the e-mail setup area. But how I deal with the field in a “Custom POST”?

(once again I apologize for my use of the English language, I am not a native speaker)


(Mario Magalhaes) #3

For the last question, I just receive a message from Joe Workman’s support:

“All form fields are sent as a part of the $POST variable in the request. Its up to him to develop the script to do what he wants.”

But I have tried on a test site and, although isset function is true, no value has been assigned in the $_POST array.

Has someone any experience using Foundadion Form Stack using the POST option?


(Mario Magalhaes) #4

Just to continue the saga: …

I created a very simple RapidWeaver project to show the problem with the POST - Address / POST - form action. If someone wants a copy, just ask me.

The site as generated by Rapidweaver (6 or 7) is not able to deliver to the php code at Prefix (or in a HTML Stack) the value of $_POST in real life/production sites. Curiously it works inside version 7 web server, but not in any other server (localhost MAMP or professional hosting or cloud providers).

As Joe Workman said: with this option “I am on my own” so I dared to analyze the site generated by version 7.
If I comment out the following script (consider that the generated script name end pageXX change for the different sites I have tested):

the use of $_POST works consistently as it should be in the small example or in larger sites.

I have submitted this problem also to Joe Workman and Realmacsoftware support. But, if any one can help me or show me what I have missed or just plain where I made something wrong i would appreciate.