Login / Register  search  syndication  about

          Kris Halsrud's Blog

Kris Halsrud on development and Integration with CRM and Development

SalesLogix web client: Adding validation logic client side to a button click

I recently had a request where I needed a button to perform some validations and then launch a SalesLogix report using the client side report library in the SalesLogix web client.  I thought I would show you how I did it.

My solution was done to a quickform so I was limited in what actions I had available.  What I ended up doing was loading hidden fields and then reading those fields client side.  I placed all of my code on the Page Load event like so:

Sage.Entity.Interfaces.IAccount account = this.BindingSource.Current as Sage.Entity.Interfaces.IAccount;

if (account.UserField7 != null)
{
    Contract.Value = account.UserField7;
    Sage.Entity.Interfaces.IContract contract = Sage.Platform.EntityFactory.GetById<Sage.Entity.Interfaces.IContract>(account.UserField7);
    if (contract != null && contract.CContract != null)
    {
        ContractDate.Value = contract.CContract.TerminationDate.ToString();
    }
}

string script = "function FXCheckReport() {";
script += " var contract = document.getElementById('" + Contract.ClientID + "');";
script += " if (contract!=null) var cid = contract.value;";
script += " var contractdate = document.getElementById('" + ContractDate.ClientID + "');";
script += " if(contractdate!=null) var cdate = contractdate.value;";
script += " var currentdate = '" + System.DateTime.Now + "';";
script += " if (!cid || cid=='') {";
script += " confirm('No contract specified for this account'); return false; }";
script += " else if (!cdate|| new Date(cdate) <= new Date(currentdate)) {";
script += " confirm('Contract has been terminated for this account'); return false; }";
script += " else { ShowReportByName('Personal:My Report'); return false;} } ";

ScriptManager.RegisterStartupScript(Page, GetType(), "FXCheckReport", script, true);

 

The first part of my code retrieves data from the currently bound entity and places them in hidden fields.  The second part then constructs a java script function called FXCheckReport.  This function examines the hidden fields and then based on the examination then shows various messages or if validations pass, it runs the report I want.

On my button client click action I then just called my injected function like so:

return FXCheckReport();

This is a pretty simple solution really.  You could even remove the hidden fields and just inject your values right into the java script code that is constructed, if you wanted to.  I thought this solution shows a little bit more though since you can see how to retrieve server bound controls client side.

What's This?
  
Bookmark and Share

About Kris Halsrud

   Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.


Related Content
   Limiting the Height of the Infor CRM (Saleslogix) ComboBox Popup
In my last post, I discussed how the Infor CRM (Saleslogix) ComboBox is a Dijit Select form widget. This
Posted on Jan 29, 2015 by Ryan Farley to Ryan Farley's Blog
 
   How to Disable the ComboBox Control in the Infor CRM (Saleslogix) Web Client
There's a problem with the ComboBox control in the Infor CRM (Saleslogix) Web Client. It won't di
Posted on Jan 22, 2015 by Ryan Farley to Ryan Farley's Blog
 
   Infor CRM (formerly Saleslogix) Web Client - How Time Zones Work
The Infor CRM web client utilizes  a couple of methods to determine and then present what timezones
Posted on Jan 09, 2015 by Kris Halsrud to Kris Halsrud's Blog
 
   Index of Posts for Starting with Infor CRM (Saleslogix) Development
The blogs on customerfx.com go all the way back to 2003. There's years and years worth of information
Posted on Dec 30, 2014 by Ryan Farley to Ryan Farley's Blog
 
   Bug with Binding a Picklist Control in the Infor CRM (formerly Saleslogix) Web Client v8.1 Core Update 3b
I just recently discovered a bug when using a picklist control with the  StorageMode set to "ID
Posted on Dec 29, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
Comments

 

Twitter Trackbacks for SalesLogix SalesLogix web client: Adding validation logic client side to a button click: I recently had a reques... [customerfx.com] on Topsy.com said:

Pingback from  Twitter Trackbacks for                 SalesLogix SalesLogix web client: Adding validation logic client side to a button click: I recently had a reques...         [customerfx.com]        on Topsy.com

December 28, 2010 8:22 AM

Leave a Comment

(required)  
(optional)
(required)  
Add
All contents Copyright © 2015 Customer FX Corporation
Customer FX Corporation
2324 University Avenue West, Suite 115
Saint Paul, Minnesota 55114
Tel: 800.728.5783

  Follow @CustomerFX on twitter
Follow the best news, tips, and articles
  Subscribe to Customer FX on youtube
Watch SalesLogix tutorial videos from Customer FX
Login / Register