Hi Experts ,
I am facing issue in this portal UI. when i submit the order and then click on new order then the previous Ui is open and the issue is below:
Required validation still appears when returning to the interface
Existing grid rows show red validation when a new row is added
I need fields to be required only when the user clicks Submit, not on initial load or when adding new grid rows.please help me on this problem .
a!localVariables( local!targetValue, local!submitted: false, local!docID, local!selectedProvince, local!submitClicked: false, local!isValidationOn: and(local!submitClicked, not(local!submitted)), local!responsibleSecurityStaff: if( isnull(local!selectedProvince), null, tostring( a!queryRecordType_24r4( recordType: 'recordType!{0f0e20fd-4510-4559-b087-8f3f057fa550}CDMP Province2TechMap', filters: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: 'recordType!{0f0e20fd-4510-4559-b087-8f3f057fa550}CDMP Province2TechMap.fields.{0525145e-b0fb-45bd-b8c6-c5af97956f08}province', operator: "=", value: local!selectedProvince ) }, ignoreFiltersWithEmptyValues: true ), pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 1), fetchTotalCount: false() ).data['recordType!{0f0e20fd-4510-4559-b087-8f3f057fa550}CDMP Province2TechMap.fields.{b2391a21-46ab-4e4f-a239-0e3ceea5a054}responsibleSecurityStaff'] ) ), local!checkIsActiveRecords: a!refreshVariable( value: if( a!isNotNullOrEmpty( 'recordType!{dc89af02-aaa8-4089-b223-17115bc848a3}CDMP RT Access Detail.fields.{id}id' ), a!queryRecordType_24r4( recordType: 'recordType!{dc89af02-aaa8-4089-b223-17115bc848a3}CDMP RT Access Detail', fields: { 'recordType!{dc89af02-aaa8-4089-b223-17115bc848a3}CDMP RT Access Detail.fields.{id}id', 'recordType!{dc89af02-aaa8-4089-b223-17115bc848a3}CDMP RT Access Detail.fields.{isActive}isActive' }, filters: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: 'recordType!{dc89af02-aaa8-4089-b223-17115bc848a3}CDMP RT Access Detail.fields.{officerDetailId}officerDetailId', operator: "=", value: ri!officerDetails.id ) }, ignoreFiltersWithEmptyValues: true() ), pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 1), fetchTotalCount: false() ).data['recordType!{dc89af02-aaa8-4089-b223-17115bc848a3}CDMP RT Access Detail.fields.{isActive}isActive'][1], {} ), refreshAlways: true(), refreshInterval: 5 ), /*local!currentpage1:a!refreshVariable(*/ /*value: false,*/ /*refreshOnVarChange: local!submitted*/ /*),*/ local!currentpage2: a!refreshVariable( value: false, refreshOnVarChange: local!submitted ), { a!sectionLayout( label: "Submit Jurisdiction Request", contents: {}, showWhen: not(local!submitted), divider: "ABOVE" ), a!sectionLayout( contents: { a!columnsLayout( columns: { a!columnLayout( contents: { a!fileUploadField( label: "Upload JR document/Télécharger le document JR", labelPosition: "JUSTIFIED", target: cons!CDM2_FOL_ATTACHMENTS, maxSelections: 1, value: local!docID, saveInto: { local!docID, if( a!isNotNullOrEmpty(local!docID), { a!save(ri!comments.appianDocId, local!docID), a!save(ri!comments.commentBy, "svc_cdm2portal"), a!save(ri!comments.commentOn, now()), a!save( ri!comments.comments, "JR Document uploaded by " & ri!officerDetails.officerFname ) }, null ) }, required:false, validations: { if( contains( { "docx", "DOCX", "pdf", "PDF" }, fv!files.extension ), "", "Please upload a DOCX or Pdf file/ Veuillez télécharger un fichier DOCX et un fichier PDF" ), if( and( local!submitClicked, a!isNullOrEmpty(local!docID) ), "A value is required", {} ), } ) }, width: "MEDIUM" ), a!columnLayout(contents: {}, width: "NARROW"), a!columnLayout( contents: { a!dropdownField( choiceLabels: cons!CDM2_VAL_PROVINCE, choiceValues: cons!CDM2_VAL_PROVINCE, label: "Province/Province", labelPosition: "JUSTIFIED", placeholder: "Select a Province/Sélectionnez une province", value: local!selectedProvince, saveInto: { local!selectedProvince, a!save( ri!record.province, local!selectedProvince ), a!save( ri!record.responsible_security_staff, local!responsibleSecurityStaff ) }, searchDisplay: "OFF", required: true() ) }, width: "MEDIUM" ) } ), a!richTextDisplayField( value: { a!richTextItem( text: "*TELUS retains wireline IP logs for 90 days from the event log’s date/TELUS conserve les journaux IP filaires pendant 90 jours à partir de la date du journal des événements.", color: "STANDARD", size: "SMALL" ), char(10), a!richTextItem( text: "*Date and Time must be in UTC only/La date et l'heure doivent être uniquement en UTC.", color: "STANDARD", size: "SMALL" ) }, align: "LEFT" ), a!gridLayout( label: "", labelPosition: "ABOVE", /*instructions:"*Date and Time must be in UTC only.",*/ headerCells: { a!gridLayoutHeaderCell(label: "Serial No/Numéro de série."), a!gridLayoutHeaderCell( label: "Target IP Address/Adresse IP cible*" ), a!gridLayoutHeaderCell( label: "Search Start Date/Date de début de la recherche*" ), a!gridLayoutHeaderCell( label: "Search Start Time/Heure de début de la recherche" ), a!gridLayoutHeaderCell( label: "Search End Date/Date de début de la recherche*" ), a!gridLayoutHeaderCell( label: "Search End Time/Heure de fin de la recherche" ), a!gridLayoutHeaderCell(label: ""), a!gridLayoutHeaderCell( label: ""/*, showWhen:ri!readonly*/ ) }, columnConfigs: { a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 1), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 3), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 2), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 2), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 2), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 2), a!gridLayoutColumnConfig(width: "ICON"), a!gridLayoutColumnConfig(width: "ICON") }, rows: { a!forEach( items: ri!targets, expression: a!gridRowLayout( id: fv!index, contents: { a!textField( label: "Target Sequence Number", labelPosition: "ABOVE", value: fv!index, saveInto: { fv!item.targetSequenceNumber }, refreshAfter: "KEYPRESS", readOnly: true, validations: {}, align: "CENTER" ), a!paragraphField( label: "Target IP Address", labelPosition: "ABOVE", placeholder: "If you have a port number, please enter it with IP address separated by underscore as Port number is mandatory for Wireless IP and NAT IP", value: substitute(fv!item.target, ",", char(10)), saveInto: { a!save( fv!item.target, substitute( tostring( reject( fn!isnull, a!forEach( items: split( substitute(save!value, char(10), ","), "," ), expression: cleanwith(fv!item, "1234567890_:.abcdefABCDEF") ) ) ), "; ", char(10) ) ), a!save(fv!item.createdBy, "svc_cdm2portal"), a!save(fv!item.createdDate, now()), a!save(fv!item.targetSequenceNumber, fv!index), a!save( local!targetValue, substitute(fv!item.target, char(10), " ") ) /*a!save(*/ /*fv!item.ipType,*/ /*{*/ /*if(*/ /*find("_", fv!item.target),*/ /*rule!CDM2_ER_GetIpType(targetIP: split(fv!item.target, "_")[1]),*/ /*rule!CDM2_ER_GetIpType(targetIP: fv!item.target),*/ /*),*/ /*if(*/ /*and(*/ /*a!isNotNullOrEmpty(fv!item.target),*/ /*a!isNotNullOrEmpty(fv!item.searchBy),*/ /*not(exact(fv!item.searchBy,cons!CDM2_SEARCH_BY_OPTIONS[5]))*/ /*),*/ /*"Not Applicable",*/ /*""*/ /*)*/ /*}*/ /*)*/ }, required:not(local!isValidationOn), validations: { a!localVariables( local!isIpValid: rule!CDMP_getIsIpValid(targetIp: substitute(fv!item.target, char(10), " ") ).result.body, local!ipInfo: index(local!isIpValid, "ipValidation", {}), if( a!isNotNullOrEmpty(local!ipInfo), if( find("Invalid", tostring(local!ipInfo)) > 0, local!ipInfo, "" ), "" ) ), /*Multiple IP Address Validation */ if( and( a!isNotNullOrEmpty(fv!item.target), length(split(fv!item.target, char(10))) > 1 ), "Multiple IP Addresses are not allowed. ", {} ), } ), a!dateField( label: "Search Start Date", labelPosition: "ABOVE", value: fv!item.startSearchDate, saveInto: { fv!item.startSearchDate }, required:not(local!isValidationOn), validations: { if( fv!item.startSearchDate > today(), "Please select a day on or before today.", if( and( a!isNotNullOrEmpty(fv!item.startSearchDate), a!isNotNullOrEmpty(fv!item.endSearchDate), ( fv!item.startSearchDate > fv!item.endSearchDate ) ), "'Search Start Date' can not be after 'Search End Date'", {} ) ), } ), a!textField( label: "Search Start Time", labelPosition: "ABOVE", placeholder: "HH:MM:SS", value: fv!item.startSearchTime, saveInto: { a!save( fv!item.startSearchTime, rule!CDM2_ER_CastTimeIn24Hrs(save!value) ) }, refreshAfter: "KEYPRESS", required: true(), validations: {} ), a!dateField( label: "Search End Date", labelPosition: "ABOVE", value: fv!item.endSearchDate, saveInto: { fv!item.endSearchDate }, required:not(local!isValidationOn), validations: { if( fv!item.endSearchDate > today(), "Please select a day on or before today.", if( and( a!isNotNullOrEmpty(fv!item.startSearchDate), a!isNotNullOrEmpty(fv!item.endSearchDate), ( fv!item.startSearchDate > fv!item.endSearchDate ) ), "'Search End Date' can not be before 'Search Start Date'", {} ) ), } ), a!textField( label: "Search End Time", labelPosition: "ABOVE", placeholder: "HH:MM:SS", value: fv!item.endSearchTime, saveInto: { a!save( fv!item.endSearchTime, rule!CDM2_ER_CastTimeIn24Hrs(save!value) ) }, refreshAfter: "KEYPRESS", required: true(), validations: {} ), a!richTextDisplayField( label: "Clone/Cloner", labelPosition: "COLLAPSED", value: { a!richTextIcon( icon: "files-o", caption: "Clone/Cloner", link: a!dynamicLink( saveInto: { a!save( ri!targets, append( ri!targets, 'type!{urn:com:appian:types:CDM2}CDM2_Targets'( id: null, caseId: ri!record.id, targetSequenceNumber: {}, systemOrderID: null(), agentID: local!responsibleSecurityStaff, searchSubmittedOn: now(), releasePursuant: fv!item.releasePursuant, searchBy: fv!item.searchBy, target: fv!item.target, targetSearchDate: fv!item.targetSearchDate, linkedTargetOrders: fv!item.linkedTargetOrders, isStandardTimeOnly: fv!item.isStandardTimeOnly, searchSiteId: fv!item.searchSiteId, searchECI: fv!item.searchECI, searchLAC: fv!item.searchLAC, searchSAC: fv!item.searchSAC, searchSector: fv!item.searchSector, searchAzimuth: fv!item.searchAzimuth, startSearchDateTime: fv!item.startSearchDateTime, startSearchDate: fv!item.startSearchDate, startSearchTime: fv!item.startSearchTime, timeZone: fv!item.timeZone, endSearchDateTime: fv!item.endSearchDateTime, endSearchDate: fv!item.endSearchDate, endSearchTime: fv!item.endSearchTime, endTimeZone: fv!item.endTimeZone, coStartDateTime: fv!item.coStartDateTime, coStartDate: fv!item.coStartDate, coStartTime: fv!item.coStartTime, coEndDateTime: fv!item.coEndDateTime, coEndDate: fv!item.coEndDate, coEndTime: fv!item.coEndTime, isDeleted: false(), deleteComment: null(), status: null(), downloadLink: null(), lastStatusUpdateDateTime: now(), groupID: fv!item.groupID, createdDate: now(), createdBy: "svc_cdm2portal", updatedBy: "svc_cdm2portal", updatedDate: now(), subInfoRecords: cons!CDM2_CHECKBOXES[16] & "; " & cons!CDM2_CHECKBOXES[49] ) ) ) } ), linkStyle: "STANDALONE", size: "MEDIUM" ) }, showWhen: {} ), a!buttonArrayLayout( buttons: a!buttonWidget_23r3( style: "LINK", confirmMessage: "Remove Target/Supprimer la cible ?", value: {}, saveInto: { a!save(ri!targets, remove(ri!targets, fv!index)) }, icon: "times", tooltip: "Remove/Supprimer" )/*showWhen: not(ri!readOnly)*/ ) } ) ) }, selectionSaveInto: {}, addRowLink: a!dynamicLink( label: "Add Target/Ajouter une cible", /*showWhen: not(ri!readOnly),*/ value: 'type!{urn:com:appian:types:CDM2}CDM2_Targets'( startSearchTime: "00:00:00", endSearchTime: "23:59:59", groupID: 61, createdDate: now(), createdBy: "svc_cdm2portal", updatedDate: now(), updatedBy: "svc_cdm2portal", isDeleted: false(), status: null(), searchBy: cons!CDM2_SEARCH_BY_OPTIONS[5], subInfoRecords: cons!CDM2_CHECKBOXES[16] & "; " & cons!CDM2_CHECKBOXES[49], timeZone: "UTC", endTimeZone: "UTC", agentID: local!responsibleSecurityStaff, searchSubmittedOn: now(), lastStatusUpdateDateTime: now() ), saveInto: { a!save( ri!targets, append(ri!targets, save!value) ) } ), validations: {}, shadeAlternateRows: true, rowHeader: 1 ) }, showWhen: not(local!submitted), divider: "BELOW" ), a!buttonArrayLayout( buttons: a!buttonWidget( label: "Submit Request/Soumettre la demande", saveInto: { a!submitUploadedFiles(), a!save( ri!officerDetails.isAccessApproved, true ), a!save( ri!record.responsible_security_staff, local!responsibleSecurityStaff ), a!save(local!submitClicked,true), a!startProcess_24r3( processModel: cons!CDMP_PM_CONS_SUBMIT_JURISDICTION_REQUEST, processParameters: { record: ri!record, targets: ri!targets, comments: ri!comments, officerDetails: ri!officerDetails }, onSuccess: { a!save(local!submitted, true), a!save(ri!record, fv!processInfo.pv.record), a!save(ri!targets, fv!processInfo.pv.targets) } ) }, submit: true, style: "SOLID" ), showWhen: not(local!submitted) ), a!cardLayout( contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: a!richTextIcon( icon: "check-circle-o", color: "POSITIVE", size: "EXTRA_LARGE" ), showWhen: and( local!submitted /*local!checkIsActiveRecords*/ ), align: "CENTER", marginAbove: "EVEN_LESS" ), a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextItem( text: "Thank you for your submission. The assigned Telus Order Number is " & ri!record.id & ". Your results will be provided to you within 5 business days.", color: "POSITIVE", size: "MEDIUM", style: "STRONG" ), char(10), char(10), a!richTextItem( text: "Merci pour votre soumission. Le numéro de dossier attribué est " & ri!record.id & ". Vos résultats vous seront fournis dans les 5 jours ouvrables. ", color: "POSITIVE", size: "MEDIUM", style: "STRONG" ) }, showWhen: and( local!submitted /*local!checkIsActiveRecords*/ ), align: "CENTER", marginAbove: "MORE" ), a!columnsLayout( columns: { a!columnLayout( contents: { a!cardLayout( contents: a!richTextDisplayField( labelPosition: "COLLAPSED", value: a!richTextItem( text: "New order / Nouvelle demande", link: a!dynamicLink( value: true, saveInto: { a!save(local!currentpage2, true), a!save(ri!targets, null), a!save(local!targetValue,null), /*a!save(local!selectedProvince,null),*/ a!save(ri!record,null), a!save(local!docID,null), a!save(local!submitted,false), a!save(local!submitClicked, false), } ), linkStyle: "STANDALONE", color: "ACCENT", size: "MEDIUM", style: "STRONG" ), align: "CENTER" ), height: "AUTO", showWhen: and( /*not(local!currentpage1),*/ not(local!currentpage2), local!checkIsActiveRecords ), style: "ACCENT", shape: "ROUNDED", marginabove: "MORE", showBorder: true ) }, width: "MEDIUM" ), a!columnLayout( contents: {} ), a!columnLayout( contents: { a!cardLayout( contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: a!richTextItem( text: "Sign out/ Se déconnecter", link: a!safeLink( label: "Sign out/ Se déconnecter", uri: cons!CDMP_VAL_PORTAL_WEB_ADDRESS, openLinkIn: "SAME_TAB" ), linkStyle: "STANDALONE", color: "ACCENT", size: "MEDIUM", style: "STRONG" ), align: "CENTER" ) }, height: "AUTO", showWhen: and( /*not(local!currentpage1),*/ not(local!currentpage2) ), style: "INFO", shape: "ROUNDED", marginabove: "MORE", showBorder: false() ) }, width: "MEDIUM" ) } ) }, height: "TALL", showWhen: and( /*not(local!currentpage1),*/ not(local!currentpage2), local!submitted /*local!checkIsActiveRecords*/ ), Style: "#ffffff" ), a!sectionLayout( contents: { if( local!currentpage2 = true, a!sectionLayout( contents: { rule!CDMP_UI_SubmitJurisdictionRequest( targets: ri!targets, record: ri!record, comments: ri!comments, officerDetails: ri!officerDetails ) } ), {} ) }, showWhen: and( local!submitted, /*local!checkIsActiveRecords,*/ local!currentpage2 ) )/*a!sectionLayout(*/ /*label:"",*/ /*contents:{*/ /*rule!CDMP_UI_RaiseAccessRequest(record:null)},*/ /*showWhen: */ /*and(*/ /*local!submitted,*/ /*not(local!checkIsActiveRecords)*/ /*),*/ /*)*/ } )
Discussion posts and replies are publicly visible
Submit buttons (and to some extent, "submit-time" validations) are meant to be used when an actual task is actually submitted (which, when validations pass, will progress the user on to a subsequent task or even break their process flow and return them to their default non-task location).
Without testing it myself in a similar setup, my assumption here is that your "submit" button is triggering the on-submit validations, which as anyone familiar with the Interface Designer will know, persist until the task/form is reloaded from scratch.
I'm not sure what the real solution here is other than redesigning your approach to accomodate for this. Perhaps the portal form should turn read-only after submission and advise the user to do a browser refresh (or perhaps you could give them a clickable URL just taking them to the same form again, but a fresh copy). Part of me is curious whether the behavior would change to better suit your use case if you remove the "submit" parameter from the ButtonWidget (since there is really no "submit" from a portal), and instead use the "validate" parameter set to "True". But it may just lead to the same thing.
Thank you so much Mike Schmitt for the explanation and suggestion. Using validate: true() instead of submit: true() worked for my portal interface and fixed the issue. Really appreciate your help.Thanks alot
validate: true()
submit: true()