CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeCharge.Discussion

 updatable grid tutorial

Print topic Send  topic

Author Message
Alexey Alexapolsky
Posted: 07/30/2001, 1:01 AM

This is example how to make updatable grids in CC.
We'll use standard bookstore database provided with CC.

4 STEPS TO MAKE AN UPDATABLE GRID FORM.

0) Create a grid form.

1) CC grid form is not a real html form , that we use for various
updates.
To make it a real html form, open Header&Footer sections , add

to header : <form name="grid" method="GET" action="Grid.asp">
to footer : <input type=submit value=Submit>
</form>

2) Set type of updatable field to Label + "html checkbox" on.

3) Each input field must be tied to a certain record/
We do this by placing primary key into name attribute of input tag.
Place code below to Events/Before show :
fldprice = "<input type=text name=" & flditem_id & " value="& fldprice &"
size=8>"

4) Ok , from now on, when user clicks Submit button on your grid ,
our target action script (the same script in our case) receives a lot of
parameters (name-value pairs) in form record_id(name) + quantity(value) .
We only have to iterate through them. See code below (in example
it's in Page/Open event)

for each i in Request.QueryString
id = i
price = Request.QueryString(i)
'response.write id & "was " & price
price = replace(price,",",".")
'response.write "is " & price & "<br>"

if IsEmpty(id) or IsEmpty(price) or not IsNumeric(id) then exit for
cn.execute ("UPDATE items SET price=" & price & " WHERE item_id=" & id )
next

That's it !

Note : when making grids with multiple fields in a record sbject to update ,
we must use a more sophisticated record naming conventions in Before Show
events ,
for example :

fldprice = "<input type=text name=price" & flditem_id & " value="& fldprice
&" size=8>"

Here I append price prefix to field name to differ it from other fields that
belong to the same record.
Correspondingly , the target script that receives these params must be
aware of these conventions.

--
Alex
CC


begin 666 editable_grid.zip
M4$L#!!0````(`/9QN"J#FS&^5@8``!$3```1````961I=&%B;&5?9W)I9"YC
M8W/55V%OVS80_1X@_X'0@"P%6L=)UVZ-XP".;-=9G<2UG'0%`@RT=+&)2*1+
M47'<7[\[DK)EUVD+#.A6&4C$1_)X]_CN2)U$P@`+PQO0N5"R&1S6\/=[P+HB
M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X!.&3\[ZQIJ.BJVS0Y46V??Y_+U4.I/?1^(!?:Z?
M[N[\`U!+`0(6"Q0````(`/9QN"J#FS&^5@8``!$3```1``````````$`( #
L@0````!E9&ET86)L95]G<FED+F-C<U!+!08``````0`!`#\```"%!@``````
`
end

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.