Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Sunday, February 23, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: How Add and use JHavascript in formload or onchange method
Naili Anouar
Posts: 6
 
How Add and use JHavascript in formload or onchange methodYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Mar 12 8:56 AM
fiogf49gjkf0d

Hi all


I'm a Dynamcs CRM consultant and i'm newer in SLX, i know that's possible to add javascript to onload event of a form or on the onchange event of a filed. Can someone tell me how add and use javascript in SLX in onload or onchange evants . and if it is possible to give me the steps to do that.


Thanks a lot

[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: How Add and use JHavascript in formload or onchange methodYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Mar 12 11:13 AM
fiogf49gjkf0d

Naili:


 


  First of all, it depends on the Type of Form you are dealing with. I am assuming it is a QuickForm.


  With that in mind, you would have to add a Load Action on the Form (c# snippet). On that snippet, you would create your Javascript function into a String Variable, then register it on the Page.


  Within the Javascript code, you could add a Listener to the Control you are working with. However, keep in mind that the SLX Controls are Composite Controls, and may have multiple parts within them, so you need to find out exactly which Item you are targetting. (You could use IE Developer's Tool to view how the Control is render and to choose the Appropriate item to hook your code into).


 


 

[Reply][Quote]
Naili Anouar
Posts: 6
 
Re: How Add and use JHavascript in formload or onchange methodYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Mar 12 12:11 PM
fiogf49gjkf0d

Hi Raul


First thanks for replying.


Your idea is very useful and nice but i need to know if there is a way to write javascript code and function in the form withowt using C# to register it.


I mean if for exemple i need to write a function or code javascript in the form and after that call it in the form load like what we do in classic asp.net page.


this will let me to use function stocked in external library of javascript


Thanks again

[Reply][Quote]
Naili Anouar
Posts: 6
 
Re: How Add and use JHavascript in formload or onchange methodYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Mar 12 12:15 PM
fiogf49gjkf0d

otherwise i mean to do that like what we can do in classic asp.net, look to the exemple below


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <script>
        ShowValue = function()
        {
            alert(document.getElementById("TextBox1").value);
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="TextBox1" runat="server" Text="2"></asp:TextBox>       
    </div>
    </form>
</body>
</html>


 

[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: How Add and use JHavascript in formload or onchange methodYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Mar 12 12:48 PM
fiogf49gjkf0d

Naili:


  This is exactly why I asked what type of Forms.


  Unfortunately, when you look at a QuickForm within the App Architec, it is an XML Document that tells the Architect how to Generate an ASCX file.


  So, in theory you could go into the Deployed site (if not compiled) and apply your changes directly, but keep in mind that next deployment your changes will be gone.


 


  A quick way to achieve what you want easily (but risking affecting other pages) is to add your JavaScript to the Master Page. Now, that means that your script will run on every single page on the System, so you would have to add code to ensure it is the right control and the right page (I wouldn't recommend this method).


 


  Another Method is to convert your form to a Custom Form and then adding your code on it, but you would still need to use C# to register your script. Remember that these are WebParts, and there are issues with JS when the Part is not Shown when a Page loads (for Tabs) or if it is a Dialog, so your script may not work as expected.


 


  Also, as Stated, the SLX Controls are Composite Controls, so even if you were to get a reference to the TextBox for a given control and change its value, it may not be reflected on the Database as the control may actually use hidden fields to track its actual values.


 


  Sorry if it sounds like I am giving you hard ways to get it done, I am just trying to make you aware of the Complexities involved on making such change.

[Reply][Quote]
Naili Anouar
Posts: 6
 
Re: How Add and use JHavascript in formload or onchange methodYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Mar 12 3:49 PM
fiogf49gjkf0d

Raul thanks again


as you said we have no way to call javascript code or function without using registring with c# code.


And i'don't like to modify deployed site if my work will be gone after the next deployement.


now, let's say that we will use register method, and we registring a code that call javascript fuction in .js file, where must i put the .js file and what must i do in order that the form support .js file.


thanks

[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: How Add and use JHavascript in formload or onchange methodYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Mar 12 4:24 PM
fiogf49gjkf0d

If you make sure that your functions and Global Variables names are unique, you could add it to the Base.Master file.


 


By doing so, your script will be available from almost all areas of the system.


 

[Reply][Quote]
Naili Anouar
Posts: 6
 
Re: How Add and use JHavascript in formload or onchange methodYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Mar 12 4:48 PM
fiogf49gjkf0d

Raul


Ok thanks Raul, iw ill try to do that


thakns a lot

[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: How Add and use JHavascript in formload or onchange methodYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Mar 12 11:08 AM
fiogf49gjkf0d

To clarify my post:


 


  Your actual js file should be added to the VFS under the Support Files structure.


  Then, to reference that file you would define an entry within the Base.Master file.


 


 

[Reply][Quote]
Naili Anouar
Posts: 6
 
Re: How Add and use JHavascript in formload or onchange methodYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Mar 12 4:01 PM
fiogf49gjkf0d

 


thanks too much Raul, this is very helpful

[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 2/23/2025 4:12:31 PM