Table Spec:

<TableSpec

xmlns="bb_appfx_table"

xmlns:common="bb_appfx_commontypes"

ID="dd14cee8-12a1-4dfa-aa37-7a8c7810fb75"

Name="Test UI"

Description="Test UI"

Author="DSS"

Tablename="USR_TESTUI"

>

<!-- define fields on the table -->

<Fields>

<TextField Name="COMPANYNAME" Description="Company Name" Length="50"/>

<TextField Name="STATENAME" Description="State" Length="20"/>

</Fields>

</TableSpec>

Add Form Spec:

<AddDataFormTemplateSpec

xmlns="bb_appfx_adddataformtemplate"

xmlns:common="bb_appfx_commontypes"

ID="4b63a9ac-e791-44b5-b065-cd8174820e23"

Name="Test UI Model Add Page"

Description="Test UI Model Add Page"

Author="Blackbaud Product Development"

DataFormInstanceID="eb9f8269-7927-41db-8fde-09b852ee8720"

RecordType="Constituent"

>

<SPDataForm>

<!-- describe the save SP -->

<SaveImplementation SPName="USP_DATAFORMTEMPLATE_ADD_TestUI">

<common:CreateProcedureSQL>

<![CDATA[

create procedure dbo.USP_DATAFORMTEMPLATE_ADD_TestUI

(

@ID uniqueidentifier = null output,

@CHANGEAGENTID uniqueidentifier = null,

@COMPANYNAME nvarchar(50) = '',

@STATENAME nvarchar(20) = ''

)

as

set nocount on;

if @ID is null

set @ID = newid()

if @CHANGEAGENTID is null

exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output

declare @CURRENTDATE datetime

set @CURRENTDATE = getdate()

begin try

-- handle inserting the data

insert into dbo.USR_TESTUI

(ID, COMPANYNAME, STATENAME, ADDEDBYID, CHANGEDBYID, DATEADDED, DATECHANGED)

values

(@ID, @COMPANYNAME, @STATENAME, @CHANGEAGENTID, @CHANGEAGENTID, @CURRENTDATE, @CURRENTDATE)

 

end try

begin catch

exec dbo.USP_RAISE_ERROR

return 1

end catch

return 0

]]>

</common:CreateProcedureSQL>

</SaveImplementation>

</SPDataForm>

<!-- describe fields on the form, which correspond to parameters on the SP. Note that system parameters

like the context @ID, @CONTEXTID, and @CURRENTAPPUSERID need not be listed. -->

<common:FormMetaData FixedDialog="true">

<common:FormFields>

<common:FormField FieldID="COMPANYNAME" Caption="Company Name" DataType="String" MaxLength="50" />

<common:FormField FieldID="STATENAME" Caption="State" DataType="String" MaxLength="20" />

</common:FormFields>

<common:WebUIComponent>

<common:UIModel AssemblyName="SampleUIModel.dll" ClassName="SampleUIModel.AMJ.TestUIModelAddPageUIModel" />

<common:WebUI>

<common:DefaultWebUI />

</common:WebUI>

</common:WebUIComponent>

 

<common:UIActions>

<common:UIAction ActionID="BUTTON" Caption="Click Me" Description="Click Me">

</common:UIAction>

</common:UIActions>

 

</common:FormMetaData>

</AddDataFormTemplateSpec>

HTML Spec:

<div id="#MAP#TestUIModelAddPage">

<h2 id="#MAP#FORMHEADER_value"></h2>

<div class="bbui-forms-fieldset-column">

<table>

<tr id="#MAP#COMPANYNAME_container">

<td>

<label id="#MAP#COMPANYNAME_caption" for="#MAP#COMPANYNAME_value"></label>

</td>

<td>

<input id="#MAP#COMPANYNAME_value" type="text" />

</td>

</tr>

<tr id="#MAP#STATENAME_container">

<td>

<label id="#MAP#STATENAME_caption" for="#MAP#STATENAME_value"></label>

</td>

<td>

<input id="#MAP#STATENAME_value" type="text" />

</td>

</tr>

<tr>

<td></td>

<td>

<button id="#MAP#Button_action"></button>

</td>

</tr>

</table>

</div>

<!-- To define fields in multiple columns on the form, simply add/move the fields to this div

<div class="bbui-forms-fieldset-column">

<table>

</table>

</div>

-->

</div>

VB Spec:

Namespace AMJ

Public Class TestUIModelAddPageUIModel

Private Sub TestUIModelAddPageUIModel_Loaded(ByVal sender As Object, ByVal e As Blackbaud.AppFx.UIModeling.Core.LoadedEventArgs) Handles Me.Loaded

Me.STATENAME.Value = "South Carolina"

End Sub

Private Sub _button_InvokeAction(ByVal sender As Object, ByVal e As Blackbaud.AppFx.UIModeling.Core.InvokeActionEventArgs) Handles _button.InvokeAction

Me.STATENAME.Value = Me.STATENAME.Value + "2"

End Sub

End Class

End Namespace