CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> .NET

 Preserving form values

Print topic Send  topic

Author Message
kenwright

Posts: 6
Posted: 01/20/2011, 3:57 PM

I have a form to add a database record. Once the user enters all the information and submits the form I want the same form to be displayed again with all the values from the previous submission filled in as defaults. How can I do this in CCS?

I looked at viewstate but I don't see a way in CCS to use it.

I see in CCS I can preserve all the POST parameters and they get added as GET parameters in the next load of the form but they are not automatically populated in to the form. Is there an additional step I have to do in CCS to get them to populate the fields? Or do I have to hand code setting every form field (there are alot in my case)?

is there a better way to do this in CCS?
View profile  Send private message
datadoit
Posted: 01/20/2011, 4:03 PM

Sounds like you really just want to stay on the newly created record,
but now in update mode? See my post here:
http://www.codechargesupport.com/blog/index.php?action=More&post_id=2

I don't know how you would adjust it to work in .Net and presumably SQL
Server.
kenwright

Posts: 6
Posted: 01/20/2011, 5:46 PM

No, I want to contunue adding new records. The user in this case is adding a batch of records and all the records in a batch have mostly the same information and I'm trying to save the effort of reselecting all the same values for the next record to add.
View profile  Send private message
datadoit
Posted: 01/21/2011, 5:41 AM

Given that you're preserving Get and Post values, you could then for
each form field's BeforeShow add a Retrieve Value for Control action,
and you'll be retrieving CCGetFromGet().
kenwright

Posts: 6
Posted: 01/26/2011, 12:16 PM

Thatnks, that worked using the BeforeShow event and pulling the GET parameter. But there seems to be a problem with Preserve Get and Post Parameters. The first time I fill in the form the parameters are available as GET parameters. So far so good. But then if I change a value of one of the fields and do another submit, the query string of GET parameters isn't reflecting this last value! It still has the first value that was entered!

Is this by design? If so, is there a way to change the behavior? Or is there a better way to handle this? maybe session variables?
View profile  Send private message
datadoit
Posted: 01/26/2011, 1:05 PM

That is by design per standards. Post parameters will go away after a
submit.

You can either grab those values and toss them into a session variable
in the Before Insert event, or I would recommend that you grab the
last_insert_id() of the last inserted record (via After Insert event),
put that into a session variable or the URL, and then in the Before Show
for your controls do a DLookup action to get those values from the database.
datadoit
Posted: 01/26/2011, 1:17 PM

Or Convert.ToInt32(cmd.ExecuteScalar()) for .net.
ReneS

Posts: 225
Posted: 01/27/2011, 2:51 AM

Hi,

Seems what you want is "copy" the record with some fields changed.

So why not change your update button to copy... Somewhere in the forum it is explained very well, i think it was an old post of Nicole.

Search forum for "copy record" or clone record or some sort

Rene
View profile  Send private message

Add new topic Subscribe to topic   


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

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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