If you want to do this with an Action, I don’t think there are any that will send a “here’s what you submitted”-type message back to the submitter.
It would be very easy to track all the yes or no clicks in the page using JavaScript, and display them in a visible form element or just store them in a hidden form element, and that number would be submitted along with the rest of the form elements to the form recipient.
To implement this counter, you would need to do some rationalization of your form element names, and/or add some classnames to them so you could get a reference to the entire collection in one whack.
So one way to do this would be to create a new style using the Styles palette with the Name set to ja
, and some innocuous property like Color set to your text color to ensure that Freeway generates the style, but doesn’t do anything to your layout as a result.
Then click on each Ja radio button and add that style to it. Repeat for the Nee styles, with a separately-made nee
style. Once the items you want to count are identified, you can move on to adding a form field which will capture the data.
If you want this to be visible, that’s fine, just make a number field or a text field and name it something sensible, like (translated) yesAnswers
(and noAnswers
if you’re counting those). Make sure that the Name/ID field in the first tab of the Inspector matches the Name field in the third tab, if you’re dealing with a visible field. If you’re using a hidden field, you will set the name directly there, and you cannot set an ID for Freeway-generated hidden fields. (Boo.)
To track the form in real time, apply the Protaculous 2 Action to the page, and paste the following into the DOM Loaded Observer editor.
var yes_counter = $$('input[name="yesAnswers"]').first();
var no_counter = $$('input[name="noAnswers"]').first();
document.observe('click', 'input[type="radio"]', function(evt, elm){
yes_counter.setValue($$('input.ja:checked').length);
no_counter.setValue($$('input.nee:checked').length);
});
Now, no matter which radio button gets clicked, the totals will be updated in real time. When the form is submitted, the YesAnswers and NoAnswers fields will be submitted to you along with the rest of the form elements. Please note the names of the fields as described in this blob of code. If you change anything at all about your implementation of this structure in your page, then be sure that whatever you called your “YES” classname is reflected in the 4th line, and “NO” in the fifth. Whatever you name your counter fields must be exactly what you set in the first and second lines. JavaScript is case-sensitive, too, so if it doesn’t appear to work, consider that as a possible reason.
Walter
On May 2, 2014, at 9:09 AM, DTP2 wrote:
Hi,
Is there a possibility after filling in this form to show a result in a new page that tells you how many times you’ve clicked yes and a small explanation below what that number indicates?
The form itself should always be submitted to an invisible email address and if the person filling in the form also fills in his own email address it should also be send to him.
I hope this explains what I mean.
Is there someone that knows how to achieve this and can help me out here? Any help would be greatly appreciated.
http://praktijk4kids.depraktijk.biz/dyslexietest.php
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options