Search these areas:
Support Forums
Product Info

-DataWeb: What's New
-Creating an Application
-The DataWeb Designer
-Application Management
-Data Tables
-Data Tables
-Data Analysis
-Object Model
-Full-Text Search
-Domain and Email Hosting
-HotBlock Modules
-Account Management
-New Responsive UI Module

DataWeb Help
Support Forums
Script Library
Knowledge Base

Home > Support

Support Forum

Default Values
ian asked:
How to have a default value automatically appear for new records?  Two examples, in one table I have a space for country on an address form.  Most people will probably be USA, how can I have new records have USA as the default. 
In another table I have a date field.  I would like it to automatically fill the field with today's date as the default, but leave it open for editing? 
Thank you
  support (DataWeb) responded:
  Try this. Place the following script block inside your dataregion:

    if (string.equalIgnoreCase(view.region.mode,"insert")) {
        record.DateField=Date().format("short date");

The script ensures the user is in insert mode and then populates the appropriate fields with the appropriate information.

You mentioned that you were populating two different tables. I put both field updates in the same script. Modify script and field names as necessary.
  Please Log On
or create your own DataWeb Account.
Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
DataWeb, 720 North 10th Street, A #145, Renton, Washington 98057 *425-583-5970* Fax 484-770-4706* Email Us