Timer added to Form (in Cell Grid) Stopping Validation

Issues related to forms.
Post Reply
User avatar
Starb7
 
 
Posts: 292
Joined: Tue Sep 05, 2006 12:35 pm
Location: Derbyshire

Timer added to Form (in Cell Grid) Stopping Validation

Post by Starb7 »

Hi All

I have added a timer (not autostart) to a Form in cell grid here https://directgasltd.co.uk/testpages/validateerror.php as I wanted to just update a text field to show the form had been processed without reaload or redirecting the page, etc.

The problem here is the cell grid with the timer is ignoring any validation and just sending text or whatever is in the form. The one below is the same form with no timer. That validates fine.

Presumably, the fact that the submit button now triggers an event (to start the timer), the actual function of the button to validate is no longer functionsal. So, i have added an Event in the Timer to Submit the form, expecting that to do the Validation - it does not.

Q. How do I pre-flight/validate the fields using standard validation when using a timer? Would I have to write my own PHP to check the fields first?

TIA

Paul
User avatar
BaconFries
 
 
Posts: 5648
Joined: Thu Aug 16, 2007 7:32 pm

Re: Timer added to Form (in Cell Grid) Stopping Validation

Post by BaconFries »

When we have a submit button on a form it already has its own event by this I mean the user clicks the button this is its event it then sends the form to be processed by the php. If you the add an event in javascript then this overwrites the submit as mentioned. To overcome this See the following:
return true
User avatar
Starb7
 
 
Posts: 292
Joined: Tue Sep 05, 2006 12:35 pm
Location: Derbyshire

Re: Timer added to Form (in Cell Grid) Stopping Validation

Post by Starb7 »

Thanks BaconFries, will do that when back in work. Cheers
User avatar
Starb7
 
 
Posts: 292
Joined: Tue Sep 05, 2006 12:35 pm
Location: Derbyshire

Re: Timer added to Form (in Cell Grid) Stopping Validation

Post by Starb7 »

BaconFries wrote: Wed Sep 27, 2023 7:21 pm When we have a submit button on a form it already has its own event by this I mean the user clicks the button this is its event it then sends the form to be processed by the php. If you the add an event in javascript then this overwrites the submit as mentioned. To overcome this See the following:
return true
Hi BaconFries

Sorry for the late response. I have added the extra "return true;" Javacode event but still have problems. I have been trying quite a few combos and going round in circles so need to ask where the "return true;" should go, ie in the button or the timer?

Linked to this, the timer sets a text label to some text, was supposed to send the form (the "return true;" does that now) and then sets the label back to what it was. Q. How do I insert a pause between the text changes, ie 1, change text, 2 pause 2 seconds, 3 change text back, end the timer and return to the button?

Thanks for your help on this.

p.s. Small point, on the link about this JavaScript Return True, says select the 'Run Javascript' option. There is no specifc 'Run Javascript' but does show a 'Javascript' option. I realised that what is meant but if you're looking for the 'Run...' option :)
User avatar
Pablo
 
Posts: 22489
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Timer added to Form (in Cell Grid) Stopping Validation

Post by Pablo »

When you click the submit button then the page is reloaded to process the form. So, that is why this will not work.
User avatar
Starb7
 
 
Posts: 292
Joined: Tue Sep 05, 2006 12:35 pm
Location: Derbyshire

Re: Timer added to Form (in Cell Grid) Stopping Validation

Post by Starb7 »

Pablo wrote: Tue Oct 03, 2023 1:11 pm When you click the submit button then the page is reloaded to process the form. So, that is why this will not work.
Hi Pablo

Have been trying a few options (from within the available WWB options) and getting nowehere. Presumably, this will have to be some specialised code which is a shame as all I wanted to do was; a) validate the form, b) if OK change the labels text, c) wait 3 seconds and d) put the label text back again.

I would have though a number of event would have done this and the closest I can get is that the validation works, no email is sent but the labels does get flipped as th etimer starts. I suppose there needs to be a test withing the timer to say if it should proceed first.

Will continue to tinker.

Thanks
Paul
User avatar
Starb7
 
 
Posts: 292
Joined: Tue Sep 05, 2006 12:35 pm
Location: Derbyshire

Re: Timer added to Form (in Cell Grid) Stopping Validation

Post by Starb7 »

Hi Pablo

Have been looking at other options and wondered if there is a way that once a Form has been submitted, to go back to the same page but at a Bookmark, ie don't scroll back to the top, etc.

I have been looking at the HTML5 option but can't see where I can change the message that is shown - can I?

What is the Bootstrap option - there's no mention of it on the Forms https://www.wysiwygwebbuilder.com/forms.html page? Do you have any help pages on this option?
EDIT: Found the text for this here https://www.wysiwygwebbuilder.com/form_popup.html Thanks
EDIT #2: Well, that was a bust! I have no 'Toolbox -> jQuery UI/Bootstrap -> Dialog' option! HAs that been removed in favour of something else. I seem to be chasing around the various support pages and getting nowwhere :(


Cheers
Paul
User avatar
Pablo
 
Posts: 22489
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Timer added to Form (in Cell Grid) Stopping Validation

Post by Pablo »

In HTML, when you submit a form then the page will be redirected to another page. So, any timers or other scripts will no longer be valid once the form has been submitted.
But you can redirect the user to another page (the success page) and implement your own code there. I cannot help you write custom code. Because this generally take a lot of time for me too.

All options are documented in the help.
No options have been removed. But this FAQ may be helpful:
viewtopic.php?t=90479
User avatar
Starb7
 
 
Posts: 292
Joined: Tue Sep 05, 2006 12:35 pm
Location: Derbyshire

Re: Timer added to Form (in Cell Grid) Stopping Validation

Post by Starb7 »

Pablo wrote: Tue Oct 03, 2023 3:45 pm In HTML, when you submit a form then the page will be redirected to another page. So, any timers or other scripts will no longer be valid once the form has been submitted.
But you can redirect the user to another page (the success page) and implement your own code there. I cannot help you write custom code. Because this generally take a lot of time for me too.

All options are documented in the help.
No options have been removed. But this FAQ may be helpful:
viewtopic.php?t=90479
Hi Pablo

Having another 'Success' page is what I wanted to avoid. Just a text field saying processing or whatever for a few seconds then back to what what it was would be ideal. Loading another page and cloning all the elements to match the page it came from (to make it look the same) is just clunky, cumbersome and very untidy. At a push, reloading the same page and going to the same location as the form, via a Bookmark would be a closer step there - perhaps this could be added as an option?

As for no elements being removed, I have no "Toolbox -> jQuery UI/Bootstrap -> Dialog" option in my WWB v18.4 as you can see in this pic of my Toolbox https://directgasltd.co.uk/testpages/JQueryOptions.png Which one is the object I should be picking as detailed in https://www.wysiwygwebbuilder.com/form_popup.html? I guess it could have been removed manually butif so, how do I add it back? Note that the Extensions Manager doesn't seem to know about this object either so at a loss on how to add it back if I did delete it somehow :/

Cheers
Paul
User avatar
Pablo
 
Posts: 22489
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Timer added to Form (in Cell Grid) Stopping Validation

Post by Pablo »

You do not have to clone the page. it can be empty page with a script that redirects the user back to the form page.

If Dialog is not in the toolbox then you have either have removed it yourself or you running in Easy Mode.
First make sure Easy Mode is off, then right click the toolbox and select 'reset toolbox'
User avatar
Starb7
 
 
Posts: 292
Joined: Tue Sep 05, 2006 12:35 pm
Location: Derbyshire

Re: Timer added to Form (in Cell Grid) Stopping Validation

Post by Starb7 »

Pablo wrote: Tue Oct 03, 2023 4:12 pm You do not have to clone the page. it can be empty page with a script that redirects the user back to the form page.

If Dialog is not in the toolbox then you have either have removed it yourself or you running in Easy Mode.
First make sure Easy Mode is off, then right click the toolbox and select 'reset toolbox'
Sorry, should have stated, it is not in 'Easy Mode'. I havent deleted any tools and 'Resetting it' has made no difference. I can't even find this one in the Extensions manager! Where to next? Cheers
User avatar
Pablo
 
Posts: 22489
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Timer added to Form (in Cell Grid) Stopping Validation

Post by Pablo »

'Dialog' is not an extension, it's a standard tool.
You can find it in the 'Layout' section of the toolbox.

Note: you can also search for tools
User avatar
Starb7
 
 
Posts: 292
Joined: Tue Sep 05, 2006 12:35 pm
Location: Derbyshire

Re: Timer added to Form (in Cell Grid) Stopping Validation

Post by Starb7 »

Hi Pablo

Found the Tool as advised and had a go... The info/screen shotss on https://www.wysiwygwebbuilder.com/form_popup.html are a bit out of date as my Dialog is different to whats shown, but worked it out and that seems to work really well and better that reloading the page, etc.

Once again, thanks for your help.

Cheers
Paul
Post Reply