this is really bugging! me now. In a nutshell here is what I want to do:
1. on submitting a form (cform with fd:_javascript_ validation) which has been validated correctly, show a message to the user that the form is being processed. The form in question is a credit card validation page which when validated calls a paypal api which checks the credit card details and returns various values based upon whether the check was successful or not. All of that works fine! What I can't get my head around at the moment is how to send a message to the user stating that their details are being processed, as the the process can take around 9-15 seconds to process, although paypal say anywhere upwards of 30 seconds is possible. So rather than having a user sitting at a page which looks like it is doing nothing, it would be nice to display a message saying something is happening.
I thought of setting a session variable in the fd:_javascript_ section only when a return type of true is reported and then in my jk file doing something like:
<jx:if test="${cocoon.session.getAttribute ('processingDetails') == true}">
<tr>
<td colspan="2">Your details are being processing......</td>
</tr>
</jx:if>
but of course once the form has been valaidated as true the page is not re-written again so that code will never be displayed. Only if the validation failed would it be displayed. So, how to return a message to a user once a cform with required fields has been successfully validated? Any ideas?
regards
Andrew
I am not quite sure am I answer your question or not...I had done the similar work, but I didn't touch resources/forms-lib.js and resources/forms-field-styling.xsl those kind of files.
when click submit button, call a _javascript_ to validate the input, I use the regular _expression_ for validation, which is very powerful.
and if the validation checking is successful, then continue, otherwise give a alert.
2006/7/10, Andrew Madu <[EMAIL PROTECTED]>:Hi Christofer,
I think you will find that the _javascript_ in resources/forms-lib.js is very much client side. Either that or the cocoon developers have devised a way to make statements like document.body.appendChild(element) work server-side! ;-)
Any ideas anyone?
regards
Andrew
On 10/07/06, Christofer Dutz <[EMAIL PROTECTED]> wrote:Hi Andrew
How about some print-statements?
As far as I know the java-script is executed server-side, so an alert will not work. If you do a "print(case)" this should output to your console the value of case.
Regards,
Christofer
Von: Andrew Madu [mailto: [EMAIL PROTECTED]]
Gesendet: Montag, 10. Juli 2006 09:52
An: [email protected]
Betreff: ft:form-template onSubmit issue
Hi,
I have a cform which has _javascript_ validation on some form fields (widgets):
<fd:_javascript_>
if (case) {
return true;
} else {
return false;
}
</fd:_javascript_>
<fd:widgets>
</fd:widgets>
Basically what I want to happen is that when <form> is returned a value of 'true' to indicate that all form fields have been validated successfully a _javascript_ function is carried out, for example an alert is triggered alert("success").
I have edited both resources/forms-lib.js and resources/forms-field-styling.xsl and absolutely nothing is happening. Firstly how can I determine in _javascript_ whether true has been returned to the form after it has been submitted? I have tried a check on document.Form.submitted and had no joy with that. Any ideas?
regards
Andrew
