CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Templates for data entry

Print topic Send  topic

Author Message
Henryk

Posts: 63
Posted: 04/21/2009, 9:04 AM

Is there a way I can have my users select a template and have it populate some of the fields with generic information which they can then update and complete filling out a form to add a new record?

I am thinking a table of templates with the appropriate generic fields filled out. A list view would show the template names, the user clicks on it, and the data from that template table record populates a form to add a new record into the job table of records.

It seems pretty straightforward, but I have not had much luck getting it to work. If someone has some ideas, that would be great! Thank you.
View profile  Send private message
melvyn


Posts: 333
Posted: 04/22/2009, 1:34 PM

Interesting.

Let's say your form store data to table1.
Let's say the template's field are in table2.

If you see in the data source (Visual Query Builder), you'll see there's a where condition, by default WHERE id= {id} (or something so).

You'll need two identical forms, one for new entry and another to update (it can be done with the same using more complicated methods, I don't recommend now).

The record for the new will have a listbox with template's names, each template will have an id linking to it's content in table2. The idea is: when the user load the page an empty form (or hidden) is shown and a listbox with templates to choose. When the user choose a template we'll do some javascript.

First: the template list, this goes in the html, figure it out:
  
<SELECT name="templates" onchange="javascript:loadTemplate(this.value)">  
 <OPTION value="{template_id}">Template Name</OPTION>  
</SELECT>  
The above code will call the function loadTemplate() passing the value selected from listbox which will be the template id.

Now the javascript:
  
function loadTemplate(templateid){  
   location="http://mysite.com/mypage.php?id="+templateid;  
}  

That will redirect this page to this same page (only to add id=34 to the current url).

The last step: you'll populate from fields in table2 to use in table 1. Edit the datasource and look in Visual Query Builder. Add the table 2 to the query and change the WHERE condition to match table2 instead of table1. Check for fields names.

Maybe some custom sql can be need in beforeshow, that must be tested.

That's the global panorama, some changes must be done. I guess that must work after refinement.

Enjoy
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com
View profile  Send private message
Waspman

Posts: 948
Posted: 04/29/2009, 7:06 AM

I do this with 2 Editable grids. It's sort of an advanced dependent list box.

What you want is much simpler. Like Melvyn said you need 2 tables one with all the pre filled stuff and another to log the input.

Populate the master table(behind the scenes in an admin area) and let the user select the content via a dropdown or whatever. So the data is loaded from the master table into a record form. Then just hyjack the update with an custom sql insert into the log table and add any extras like date, userID and stuff. Dead easy and it works great for building quizes etc.

Let me know if you want the sql script.

Tony
_________________
http://www.waspmedia.co.uk
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.

MS Access to Web

Convert MS Access to Web.
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.