[SOLVED] Stop adding a record to db in WF Maintain
I have created a small intake form using WF maintain.Implemented the Add functionality. I have a submit Button in the Form and when i click the submit button i check for a particular Editbox.If it is null how can i stop the data being updated in db. I have given validation error message using js function ,but where do i terminate the db connection.This message has been edited. Last edited by: FP Mod Chuck,
WF8206,Windows 7,8,10 HTM,PDF,EXCEL
October 27, 2017, 07:57 AM
Maintain Wizard
In this example I have a field on my form called Field1 and an Include case called AddData.
When the user presses the button I kick off this JavaScript
function OnButton1_Click ( ) { var xxx = Form1.Field1_Edit.value; if (xxx=='') { alert("Field cannot be blank") } else { IWCTrigger("AddData");
} }
In your AddData case have a COMMIT after the Include statement. I hope this helps.
Mark
October 27, 2017, 08:42 AM
srajeevan
@Maintain Wizard Just commit as a word is enough.? This is my maintain code.
MAINTAIN FILE template
$$Declarations
Case Top
Infer template.TEMPLATE.ID into demo2;
Winform Show Form1;
EndCase
Case Add
Include template.TEMPLATE.ID from demo2 ;
Stack clear demo2 ;
EndCase
END
Can you give that commit syntax? Thanks
WF8206,Windows 7,8,10 HTM,PDF,EXCEL
October 27, 2017, 09:05 AM
Maintain Wizard
Yes! Commit saves the data to the database and closes the connection. I placed it in your ADD case.
MAINTAIN FILE template $$Declarations Case Top Infer template.TEMPLATE.ID into demo2; Winform Show Form1; EndCase
Case Add Include template.TEMPLATE.ID from demo2 ; Stack clear demo2 ; COMMIT
EndCase END
Let me know if you have any questions! Mark Derwin Mark_Derwin@IBI.com
October 27, 2017, 12:03 PM
srajeevan
Appreciate the help.I started using Maintain from last week onwards. I am getting help from people like you.
WF8206,Windows 7,8,10 HTM,PDF,EXCEL
October 27, 2017, 02:12 PM
srajeevan
When IWCTrigger("AddData") is encountered data gets added in database? In my case i have added a task in Task/Animation which runs the case Add. So eventhough i write js the task executes and null data is going inside the database.
WF8206,Windows 7,8,10 HTM,PDF,EXCEL
October 27, 2017, 02:40 PM
srajeevan
I fixed it. I gave the task execution inside the validation loop. If(field is null) alert("Please select"); else task execution.