[Pro] annoying little problem may be hard to fix

Hi,

I have a little form where the student enters their name and it then releases the person to see the next (HW) page. Walt helped me set this up a while ago.

It then sends me an email with their name as per the form like normal.

I also have the validate action on the name so they have to type their name.

I recently changed 2 things. I changed from the send form action to the PHP feedback form action. I also changed the send button from a graphic that sends to a real send button.

my problem is now, and I am not sure why, when a person hits the send button WITHOUT typing a name in, it sends me an email with no name in it and still does not let them through which is good.

The only issue is now it shows the validate error, but then sends an email with no name and sends them back to the page with the form.

I am looking to get back to:
if they click send with no name, it shows validate error and does NOT send me an email.

Hope this makes sense to the pros.
here is the page with the form for the kids…

http://hoffkids.com/hwterms.html

thanks much,

Barry


freewaytalk mailing list
email@hidden
Update your subscriptions at:

If Walter helped you with this was there some extended code involved to make the magic work.

I suspect changing the action and/or changing the submit button has deleted/changed that code.

But without knowing what you had to start with???

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:

Dave, let me find the original post here in freeway.
It uses protaculous2 and cookiejar


freewaytalk mailing list
email@hidden
Update your subscriptions at:

I am pretty sure that Walters magic involved the use of a cookie.

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:

oh I may be getting the other trick he did which was to get the persons name to appear on the next page after they type it in…

man this will be tough to pinpoint.


freewaytalk mailing list
email@hidden
Update your subscriptions at:

Dave I just realized all the magic cookie stuff was more about getting their name to appear on the next page.

To simply not allow them into the next page meant to make the ERROR page the same page itself and the success page the next one.

Just not sure why the SEND button is sending me an email when they clearly didn;t type in their name and got the Validate message.


freewaytalk mailing list
email@hidden
Update your subscriptions at:

Dave, I removed the validate action just to simplify.

Now when the person hits submit with no name typed in, it sends them back to this same page, but still sends me an email with the name blank.

Is this a normal function of how the send button works? I never used the included one until now.

http://hoffkids.com/hwterms.html

Thanks


freewaytalk mailing list
email@hidden
Update your subscriptions at:

ok I quickly answered my own last question, NO that is not the normal behavior.

I tried another form with this type of button and I see the page does NOT RELOAD like mine is. this is the issue.

What is the reloading that we are seeing after the button is pressed and the validate error comes up??


freewaytalk mailing list
email@hidden
Update your subscriptions at:

Dave… look at the end of Walt wrote when we put together the thing that makes their name appear at the end. SOmehting about if they do not type their name…

I think this is it. It is senfing them to another page but emailing me. It never did this…

From Walt

Very easy. Let’s do it in JavaScript first, since that won’t require any changes to the rest of your site. First lesson of cookies — you can only read them on the NEXT page, not the current page. So if you set a variable in a cookie on one page, you can read it on the next, but not the current page.

Apply Protaculous 2 to the page, if you haven’t already. In the Additional JavaScript Libraries section, enter ‘cookiejar’ (without the quotes) in the name field, and ‘http://cdn.freewaypro.com/cookiejar/1.5.1/cookiejar.js’ (without the quotes) in the CDN URI field.

Click on the DOM Loaded Observer button, and enter this code: cookie-name.js · GitHub

Draw an HTML box where you want the name form to appear, and insert a text field and a button in it. Name the text field ‘name’, using the Name/ID field of the Inspector, and confirm in the third tab that the Name attribute is properly set to ‘name’.

Name the button ‘send’, using the same degree of care. Set the Value of the send button to whatever you like. (Optional: if you want the setting of the name to automatically navigate the user to the next page, then in the Page / Form Setup, set the Action to the actual filename of the second page, and the Method to GET.)

On the second page, draw an HTML box where you want the name to appear, and type out a placeholder name. Using the Inspector, change the name of this HTML box to nameDisplay. When styling the name in the placeholder, make sure that you use a Paragraph style, not an inline (Inspector-made) style. Select the name, and make sure that the style that is highlighted in the Styles palette has a pilcrow (¶) before its name.

On that same page, apply the Protaculous 2 Action, also include the link to the cookiejar script, and in the DOM Loaded Observer, type the following:

What this will do is redirect the user back to the index.html page if they haven’t entered their name (assuming of course that index.html is where that happens) so adjust that URL if it’s not correct.


freewaytalk mailing list
email@hidden
Update your subscriptions at:

The email will only happen if validation passes. If your form handler is invoked (you get mail) then that means the form was submitted. My understanding of the Validation Action is that it traps the form submission, and does not let it happen if any of the required fields are not completed. The PHP Feedback Form Action may be able to reject a form without a name and e-mail address filled in, I think. That would mark the form as in error, and it would never be sending you mail – it would be redirecting to the error page you defined in the Action.

Walter

On Nov 9, 2015, at 9:28 PM, Hoffkids email@hidden wrote:

Dave… look at the end of Walt wrote when we put together the thing that makes their name appear at the end. SOmehting about if they do not type their name…


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Thanks so much Walt for responding since we set this up a while ago. I believe this has to do with the fact that I changed from the

SEND FORM
to the older

PHP Feedback Form (to get IP).

(but I also changed the send button so I was not sure if I screwed up something as there is tricky code involved)

Before I did this everything worked great and if I recall if someone pressed the send graphic button without a name typed in, it showed a validation popup error but did NOT send me a blank email each time which it is now doing.

As I try to figure this out, does it have to do with all the cool code you wrote that lets them see their name on the next page? The reason I ask is in the code it had something to do with sending them BACK to the same page should they not type a name (see your notes above) and maybe that is what it is doing??

maybe it “thinks” the form went thru and it sends me a blank email and sends them back to type their name??

thanks for hangjng with me thru this hiccup.

Barry


freewaytalk mailing list
email@hidden
Update your subscriptions at:

i feel like even thought his was never a problem before this is related somehow as it is sending them back but also sending email.

Maybe I should just switch back to SEND FORM and see if that is the problem??

"On that same page, apply the Protaculous 2 Action, also include the link to the cookiejar script, and in the DOM Loaded Observer, type the following:

var jar = new CookieJar({path: ‘/’, expires: 86400});
var name = jar.get(‘name’);
if(!!name){
$(‘nameDisplay’).down(‘p’).update(name);
}else{
window.location.href = ‘/index.html’;
}
view rawcookie-read.js hosted with :heart: by GitHub

What this will do is redirect the user back to the index.html page if they haven’t entered their name (assuming of course that index.html is where that happens) so adjust that URL if it’s not correct."


freewaytalk mailing list
email@hidden
Update your subscriptions at:

Walt,

I am closer to knowing what is happening.

I did many tests with different situations (send form and php form) took off Protaculous 2 code (see above) with both forms.

Here is what I found…

Using the PHP feedback form and the protactulous stuff all deleted, it works fine.

The protac code was made to send the person back to the form page and with the PHP feedback form ONLY it is seeing that as a page sent and thus sending me an email. Except there is no name in the email I get since the person never typed their name in.

In short, with the send form it never sent the email when redirecte d back, with PHP form it does.

can I have PHP feedback form work with protac code that gives cool name on next page and not have email sent if person hits OK after validate error??

whewww

Barry


freewaytalk mailing list
email@hidden
Update your subscriptions at:

The validation that is built into PHP Form (and Send Form) is run at the server, not the browser. The Protaculous 2 code runs in the browser, and monkeys with the form submission process, so it is entirely possible that it is redirecting the browser before the handler ever gets to validate it.

This does not make any sense to me, though. What I recommend you try, before you spend any more time with the current document, is to create a new document, and set it to publish into a “hidden” folder on your server. (Just name it something cryptic, and make sure that only your new document publishes there.) Then try to recreate the form, first doing just the PHP Feedback Form part. See if the validation works. Next, make a new form, and use Send Form, and try that one. No JavaScript, no Validation Action (which is also JavaScript). See if this works.

My suspicion here is that you may have to change the way the JavaScript works to set the name in a cookie, or maybe push that task over to your form handler (in PHP) rather than using JavaScript at all. But try to isolate as much as possible, so your test only covers one thing, not the many things that have built up on your site over time.

Walter

On Nov 11, 2015, at 11:35 AM, Hoffkids email@hidden wrote:

Walt,

I am closer to knowing what is happening.

I did many tests with different situations (send form and php form) took off Protaculous 2 code (see above) with both forms.

Here is what I found…

Using the PHP feedback form and the protactulous stuff all deleted, it works fine.

The protac code was made to send the person back to the form page and with the PHP feedback form ONLY it is seeing that as a page sent and thus sending me an email. Except there is no name in the email I get since the person never typed their name in.

In short, with the send form it never sent the email when redirecte d back, with PHP form it does.

can I have PHP feedback form work with protac code that gives cool name on next page and not have email sent if person hits OK after validate error??

whewww

Barry


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

thank you Walt


freewaytalk mailing list
email@hidden
Update your subscriptions at: