Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
7 replies
Subscribers
8 subscribers
Views
1599 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
User Interface
Hi all, as you know ,form has 4 form-level event rules : load, save, sumbit
eaglez
over 10 years ago
Hi all,
as you know ,form has 4 form-level event rules : load, save, sumbit, failedValidation.
failedValidation event suppose to be triggered when form validation fails.
but when the submit button contains a confirmation message, failedValidation event won't be triggered.
form validation is still triggered.
do you have any ideas about this issus?
i'm using appian6.71.
btw, what i want to do is that we have serveral tabs in one form, when validation fails, we hope it can automatically jump to the error tab.
thanks in advance....
OriginalPostID-88408
OriginalPostID-88408
Discussion posts and replies are publicly visible
0
eaglez
over 10 years ago
if someone can give me some advice on the function i want.
that will be appreciated very much.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Eduardo Fuentes
Appian Employee
over 10 years ago
1. You can do this with JavaScript but remember that this won't be compatible with Mobile Enabled / Tempo forms.
2. In scenarios where there are tabs, if you are on one tab and you hit submit the form will not submit if the validation fails but the message is displayed under the field in the corresponding tab, you will not know what made the validation fail until you go to that specific tab and see the message.
This approach can be achieved with JQuery. First retrieve all the elements with the class "errorMessage", iterate over this array and if the error message is not empty and is being currently displayed add it to the alert:
function retrieveValidationErrorMessages(){
var errorMessages = $(".errorMessage");
var validationErrors = "";
for (var i=0; i< errorMessages.length; i++){
validationErrors += errorMessages[i].innerHTML != "" && errorMessages[i].style.display != 'none' ? errorMessages[i].innerHTML + "<br/>" : "";
}
if (validationErrors != ""){
asi.alert(validationErrors);
}
}
This function should be called as part of the failedValidation event of the form.
I am attaching an example application showing this approach
forum.appian.com/.../22907
The model is called Tab Validation under Process Models - Forum. The JS is called retrieveValidationErrors under Default
Community > Temporary Documents Knowledge Center > Temporary Documents > JS Libraries.
In the example if you don't type a value in the fields and try to submit the form it will display a popup indicating what field failed.
3. Here's another version this one gives a single message at a time until the form is valid and has some formatting so as not to overwhelm the user:
function showErrors(){
errorList = $('p.errorMessage');
for(i=0;i<errorList.length;i++){
if(errorList[i].style.display!='none'){
re = new RegExp('.*'+errorList[i].parentNode.parentNode.namespace);
asi.alert('<table><tr><td><font color = red><b>There is an Error submitting this form!</b></font></td></tr><tr><td>'+
errorList[i].parentNode.parentNode.id.replace(re,'')+': '+
errorList[i].innerHTML+'</td></tr></table>');
break;
}
}
As you mentioned this will only work if there's NO CONFIRMATION MESSAGE.
If there's a confirmation message you could try what somebody else suggested in a different thread which is using jquery to attach a method directly to the submit button by attaching the following code the "onload" event of the form.
$('.submitButton').click(
function showErrors(){
debugger;
errorList = $('p.errorMessage');
for(i=0;i<errorList.length;i++){
if(errorList[i].style.display!='none'){
re = new RegExp('.*'+errorList[i].parentNode.parentNode.namespace);
asi.alert('<table><tr><td><font color = red><b>There is an Error submitting this form!</b></font></td></tr><tr><td>'+
errorList[i].parentNode.parentNode.id.replace(re,'')+': '+
errorList[i].innerHTML+'</td></tr></table>');
break;
}
}
})
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
eaglez
over 10 years ago
wow, thank you very much. this issue block me a long time.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
eaglez
over 10 years ago
Hi eduardo, there is another problem.
i used following code.
$('.submitButton').click(
function showErrors(){
debugger;
errorList = $('p.errorMessage');
for(i=0;i<errorList.length;i++){
if(errorList[i].style.display!='none'){
re = new RegExp('.*'+errorList[i].parentNode.parentNode.namespace);
asi.alert('<table><tr><td><font color = red><b>There is an Error submitting this form!</b></font></td></tr><tr><td>'+
errorList[i].parentNode.parentNode.id.replace(re,'')+': '+
errorList[i].innerHTML+'</td></tr></table>');
break;
}
}
})
If there's a confirmation message , it does not work either.
it will block the confirmation message and the fomr cannot be submited although there is no error message.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
eaglez
over 10 years ago
also as you know , sometimes errorMessage won't gone until we submit the form.at that time,although form is valid, there will be still a alert msg.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
eaglez
over 10 years ago
it's really weird that the form cannot be submitted when the confirmation message is blocked
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
eaglez
over 10 years ago
hi eduardo,are you still there?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel