Because I've shrewdly negotiated a 1 year contract with an overpriced and underpowered hosting company, sometimes there is a lengthy wait whilst processing a form (sometimes as long as 30 secs, sometimes instantaneous). Because of this, I would like to have a thanks this is processing text to appear under the submit button, in much the same way as the validation warnings, so nobody thinks the page has frozen. Then, they may stick around until the thanks page comes up!
Thanks for your help on this and previous questions.
Hi, may be try to add a div under your submit button code and onsubmit event for the button with a simple text like this :
<input type="submit" onclick="document.getElementById('somediv').innerHTML= 'Thanks, dont submit again';">
<div id="somediv"></div>
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Thanks for replying.
However I am still unclear.At present I just have
<input name="SubmitButton" type="submit" value="Submit" /> in my form and thats all I do. (apart from a redirect entered in the formURL box)
Could you explain in idiotspeak your suggestion?
Thanks for your patience!
I really underplayed the idiotspeak part here - or at least the level of idiot!
I replaced my input with the 2nd bit of code that you suggested and it plays out exactly how I wanted on the form. However, it now no longer processes the form!
It now doesn't validate or process in any way, shape or form.
By the way, I would only want the button replaced or printed under if the validation has been passed, I'm probably wrong, but wouldn't this code, even if I interpreted it correctly, just print it as soon as the button is clicked regardless of validation success?
Just so I'm clear, I did absolutely nothing but replaced the code in my form. Is there another step that is so obvious even a well trained monkey would know about it?
<tr> <td colspan="2"><div align="center">
<div id='submit_message' >
<input name="SubmitButton" type="submit" value="Submit" onclick="document.getElementById('submit_message').innerHTML= 'Thanks, your form is being processed';" />
</div> </div></td>
Thanks for your continued patience.
Thanks very much for looking at it again!
The first one does as expected, the second one doesn't though (which is not an issue).
However, as I suspected in my previous post, it puts up the thanks please don't post again even if it fails the validation. This may put off people who need to post again if they made an error! Is there any way of putting this only if it passes the validation, but before it goes through the rest of the processing?
Hi zaphod71,
Hmmmm . . . I'm sure it's possible but I don't think it's simple . . . perhaps by looking at the classes in the page. I'll take another look but no promises.
Bob
try this:
<input name="SubmitButton" type="submit" value="Submit" onclick="this..addEvent('onFormValidate', function(result, form) { if(result){document.getElementById('submit_message').innerHTML= 'Thanks, dont submit again'; }}" />
<div id='submit_message' > </div>
I'm really not sure if this will work!
Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Thanks, once again, for trying to help.
The above code didn't break anything. eg validation worked and the form db and email all worked.
However message didn't come up at all this time.
Hi zaphod71,
I think that maybe - this..addEvent - should be - this.addEvent - with only one dot. Please try that.
Bob
yes, please try the fix posted by Bob, its a typo of me!
Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Thanks again,
Unfortunately, it made no difference.
It didn't break anything, it just ignored it.
As much as I'd like this solved, I think I've already took up to much of your time.
Thanks for trying.
what makes it harder is the validation, if you have a normal JS alerts validation then it would be easy, I need to test this code myself to know if its even possible, will try to do sometime but can't tell when exactly.
Best regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
I appreciate your help.
I don't want to undervalue your time, so I think it may be cost/time effective to swallow the contract and switch host.
Your response has been great. I wish Microsoft's support was even a quarter of good. Perhaps then I wouldn't have wasted a good six months on crm3!
Thanks again.
Thanks for the reply,
Seems to work flawlessly in terms of it appearing on the form (so I must have got that part right!)
However, for some reason it doesn't actually submit the data or continue on to the redirect page.
(I have checked I've put in the opening { and the two closing }'s)
Thanks for all your time.
Hi zaphod71,
Please remove any redirect url temporarily, turn DeBug on in the form General Tab and see if you get any out put when you submit. That will tell us if the form fails to submit or something goes wrong after that.
Bob
Looks like a javascript solution was not trivial. Is it easier to show a "thank you" message on a validated submitted form using server side code? (The ServerSide Validation code block shows a red error box if there is a string, but there does not seem to be a mechanism for showing a "thank you" kind of message.)
Hi Joomlanoob,
Just answered your other post on this.
Bob
Hi guys, I have the latest version installed (3.1RC5.5) but when I try to use the above checkSubmit function, I get an error in the Firefox Error Console: "Validation is not defined" and the script doesn't work. Does this code need to be updated somehow?
Thanks.
Any update on my previous post guys?
Hi andyss,
Very late - but my guess is that the LiveValidation script files aren't being loaded? Do you have Validation enabled for the form?
Bob
addevent or addeventlistener work for different browsers.
IE seems to prefer 'onsubmit' (within form tag) to run the code correctly, that said, if you post to the same page you will need to add 'onclick' to the submit button, if not make sure you remove this onclick event.
anyway try this:
add
onsubmit="dothis(this);"
To: 'Form tag attachment:' under 'Core/View Form Settings'
and add this
function dothis(thisform)
{
with (thisform)
{
document.getElementById('SubmitButton').disabled=true;
}
document.getElementById('submit_message').innerHTML = 'Thanks, dont submit again';
}
to 'Form JavaScript:' under 'Form Code'
Edit: Make sure the submit button has id ref of id="SubmitButton" to reference.
Hi andyss,
Just looked again and the old script is for an earlier version of ChronoForms using a different validation suite. Try the code MyPetHampster suggested.
Bob