In essence I need an editable grid; behaviour more like a traditional spreadsheet. I tried working with grids but that didn't work out so well, so, I thought a repeater might be better. The look is closer to what I was hoping for, except, I can't save anything. Perhaps it's my complete lack of knowledge on VFP or perhaps WC, but, inevitably nothing works.
In the case of the repeater, here is what I have in the WC5 form
<code lang = "html">
<ww:wwWebPanel ID="WwWebPanel1" width="990px" Height="500px" ScrollBars="Auto" runat='server'>
<table class="blackborder">
<ww:wwWebRepeater ID="GeoParms" runat="server" DataSource="SocioGeoDemoGraphic_Parms">
<ItemTemplate>
<tr>
<td style="width: 50px;">
<ww:wwWebCheckBox runat="server" ID="chkSelected" />
<htmlcheckbox("chkSelected_" + transform(ID),"", SocioGeoDemoGraphic_Parms.Selected) >
<!-- <ww:wwWebCheckBox ID="WwWebCheckBox1" runat="server" ControlSource="SocioGeoDemoGraphic_Parms.Selected" /> -->
</td>
<td style="width: 500px;">
<%= SocioGeoDemoGraphic_Parms.Description%>
</td>
<td style="width: 100px;">
<ww:wwWebTextBox ID="WwWebLabel1" runat="server"
ControlSource= "SocioGeoDemoGraphic_Parms.value" >
</ww:wwWebTextBox>
</td>
</tr>
</ItemTemplate>
</ww:wwWebRepeater>
</table>
<ww:wwWebButton runat="server" ID="btnSave" Text="Save" Click="btnSave_Click" />
</ww:wwWebPanel>
As you can see I tried testing tying directly to the controlsource as well,but, in either case it simply fails to save.
In the VFP code, here is basically the guts; This.Page.EnableSessionState = .T. If This.IsPostBack Endfunc Function OnPreRender() Function RenderGrid() Function btnSave_Click() *** Grab all the checkbox form variables WAIT WINDOW lncount Select SocioGeoDemoGraphic_Parms *** Because we're dealing with checkboxes which don't post values back if not set For lnX = 1 To lnCount Endfunc
Function OnLoad()
This.oUser = Createobject("Client_Dataclass")
This.lUserName=Session.GetSessionVar("SGA_username")
This.lblTxtLoggedInAs.Text="Logged in as: " + This.lUserName
This.lbl_junk.preserveproperty("text")
Else
Select Recno() As Id, Attribute, operator, Descriptio As Description, 000.00 As Value, .F. As Selected ;
FROM Addbs(Config.cDataPath)+"ClientAccess\geodemoparms" Into Cursor SocioGeoDemoGraphic_Parms ReadWrite
Endif
* Onload
This.RenderGrid()
Endfunc
This.GEOPARMS.Datasource=[SocioGeoDemoGraphic_Parms]
This.GEOPARMS.DataSourceType = 1
This.databind()
Endfunc
Local lnCount, lnX
Dimension laVars[1,2]
lnCount = Request.aFormVars(@laVars,"chkSelected_")
*** we have to update all values to unselected first.
*** If you're running against a full table you'd have to filter this update to match
*** your subset
*Update SocioGeoDemoGraphic_Parms Set Selected = .F. && where customerId = lnCustId
*** Grab the id from the Field ID
lnId = Val(Strtran(laVars[lnX,1],"chkSelected_"))
Update SocioGeoDemoGraphic_Parms Where Id = lnId Set Selected = .T.
Endfor
I trapped the result of lncount; the value is 0. Obviously I screwed up since I am apperantly gathering nothing... I have also checked to edit the cursor and you can...
What the heck am I doing wrong????
Serge