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
7 subscribers
Views
2547 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
User Interface
Hi, need help on my requirements where in I need to set fields on my form as req
Jess
over 10 years ago
Hi, need help on my requirements where in I need to set fields on my form as required. I have read that advance form utilities will do the trick but however I'm getting error while trying my code. Please see me code below and let me know if I mis something.
if (window.FormAPI.getValue("button1").id=="Create")
{
window.FormAPI.setRequired("text4",true);
window.FormAPI.setRequired("text6",true);
window.FormAPI.setRequired("text9",true);
window.FormAPI.setRequired("text10",true);
window.FormAPI.setRequired("radio22",true);
window.FormAPI.setRequired("dropdown14",true);
}
else
{window.FormAPI.hide("hidden24");}
TIA!...
OriginalPostID-120790
OriginalPostID-120790
Discussion posts and replies are publicly visible
Parents
0
Chris
over 10 years ago
I use the following JS code. I create a field on the form with the ID "txtValidateForm" (which is hidden onLoad), submit button as "btnSubmit" and cancel button as "btnCancel". onLoad_Form() is called on the form load, required fields each call the validation function as: Return ValidateNotNull("fieldName"); which decides if validation should continue or if it should be bypassed - based on the value set in txtValidateForm by either the Submit or Cancel button just pressed. Cancel sets the txtValidateForm field to No, bypassing validation, where Submit sets the field to Yes which forces each required field to validate. I add a "*" just before each required field name - you can also add an image of a red "*" in there for the same display as a physically required field.
function onLoad_Form()
{
window.FormAPI.hide("txtValidateForm");
onLoadCancelButton("btnCancel");
onLoadSubmitButton("btnSubmit");
}
function ValidateNotNull(fieldName)
{
if(window.FormAPI.getValue("txtValidateForm").id == "YES") return true;
var data = window.FormAPI.getValue(fieldName).id;
if(data != "") return true;
else
{
asi.alert("Fields are Required!");
return false;
}
}
function onLoadCancelButton(btnCancel){
var buttonConfig = window.Build.util.getComponentContainer(btnCancel,window.FormDesigner.runtimeNamespace);
var clickFunction = function(){
window.FormAPI.setValue("txtValidateForm","NO");
};
buttonConfig[0].firstChild.onkeydown = clickFunction;
buttonConfig[0].firstChild.onmousedown = clickFunction;
}
function onLoadSubmitButton(btnSubmit){
var buttonConfig = window.Build.util.getComponentContainer(btnSubmit,window.FormDesigner.runtimeNamespace);
var clickFunction = function(){
window.FormAPI.setValue("txtValidateForm","YES");
};
buttonConfig[0].firstChild.onkeydown = clickFunction;
buttonConfig[0].firstChild.onmousedown = clickFunction;
}
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
Chris
over 10 years ago
I use the following JS code. I create a field on the form with the ID "txtValidateForm" (which is hidden onLoad), submit button as "btnSubmit" and cancel button as "btnCancel". onLoad_Form() is called on the form load, required fields each call the validation function as: Return ValidateNotNull("fieldName"); which decides if validation should continue or if it should be bypassed - based on the value set in txtValidateForm by either the Submit or Cancel button just pressed. Cancel sets the txtValidateForm field to No, bypassing validation, where Submit sets the field to Yes which forces each required field to validate. I add a "*" just before each required field name - you can also add an image of a red "*" in there for the same display as a physically required field.
function onLoad_Form()
{
window.FormAPI.hide("txtValidateForm");
onLoadCancelButton("btnCancel");
onLoadSubmitButton("btnSubmit");
}
function ValidateNotNull(fieldName)
{
if(window.FormAPI.getValue("txtValidateForm").id == "YES") return true;
var data = window.FormAPI.getValue(fieldName).id;
if(data != "") return true;
else
{
asi.alert("Fields are Required!");
return false;
}
}
function onLoadCancelButton(btnCancel){
var buttonConfig = window.Build.util.getComponentContainer(btnCancel,window.FormDesigner.runtimeNamespace);
var clickFunction = function(){
window.FormAPI.setValue("txtValidateForm","NO");
};
buttonConfig[0].firstChild.onkeydown = clickFunction;
buttonConfig[0].firstChild.onmousedown = clickFunction;
}
function onLoadSubmitButton(btnSubmit){
var buttonConfig = window.Build.util.getComponentContainer(btnSubmit,window.FormDesigner.runtimeNamespace);
var clickFunction = function(){
window.FormAPI.setValue("txtValidateForm","YES");
};
buttonConfig[0].firstChild.onkeydown = clickFunction;
buttonConfig[0].firstChild.onmousedown = clickFunction;
}
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data