Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, February 22, 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!
 Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: javascript not picking up hidden field values
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
javascript not picking up hidden field valuesYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Apr 08 8:21 PM
Ihave some hidden fields that hold various pieces of data determining whether javascript should fire or not. I had these in textboxes thinking I could just hide the panel they were on when it was time.. Well, I hid the panel and the values are not available.

So I moved from hidden textboxes to hiddenfields. The C# seems to pick this up fine, but the javascript is coming up blank. The hidden fields are getting the proper values.

HTML

C#
FormType.Value = Request.QueryString["certtype"];
Javascript
document.getElementById('ctl00_MainContent_DivXCertificationApplication_FormType').value == 'odm')

When FormType was a textbox everything worked fine. I double checked the control name in the source of the rendered web form.

Any thoughts? thanks
[Reply][Quote]
Nicolas Galler
Posts: 93
 
Re: javascript not picking up hidden field valuesYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Apr 08 11:15 PM
Basically this should work fine since you are working entirely in Javascript with no ASP.NET or Saleslogix involved... Have you tried bringing up the form in firebug and echoing the value, or adding an "alert" statement in your JS?

One problem (though probably not the case here since you checked the source) may be if the id of the control changes from one post to another (since it is dynamically built by ASP.NET), normally (in the "raw" asp.net) you can get around it by constructing your JS with something like "<%# FormType.ClientID %>" but I dont know how to get to that same effect in the Saleslogix forms (in the AA)?
[Reply][Quote]
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
Re: javascript not picking up hidden field valuesYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Apr 08 11:52 PM
Actually on further review the javascript is fine.. I have a form with many panels that are toggled on and off. I was tracking the visbility of panels as they are toggled among other things like a value from the querystring in the textboxes. Thought I could just hide the textboxes, but the hidden textbox values aren't available to C# or javascript. I tried labels, literals, hidden fields.. The labels worked a couple of times, but seem buggy and not working at all now. So I need to store some variables that are currently set onload of the ascx that I can access with C# and javascript as the user fills out the form..
[Reply][Quote]
Timmus Agersea
Posts: 328
 
Re: javascript not picking up hidden field valuesYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Apr 08 1:15 PM
Steve,

I have seen the same behavior with hidden textboxes so I came to the conclusion that ASP.net doesnt even render them. This may be inaccurate but since I cant access their properties the net result is the same

I do what you are trying to do on most of my asp.net pages. I put a hidden field on the form tag use this field to communicate with the user: C# sets the property and javascript reads it on form load.

Maybe try putting your hiddenfield directly on the form and not in any panels.

Here is the javascript:

        function bodyOnLoad()
{
if (document.getElementById("hfMessage").value != "")
{
alert(document.getElementById("hfMessage").value);
document.getElementById("hfMessage").value = "";
}
}


Here is the form header:

    [form id="frmSalesContract" runat="server"]
[asp:HiddenField ID="hfMessage" runat="server" /]


Another comment is that I would use the body's onload event and not just inline javascript at the end of the page. You may be doing this but I wanted to mention it in case.

Hope that helps!

Timmus
[Reply][Quote]
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
Re: javascript not picking up hidden field valuesYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Apr 08 1:24 PM
The problem ended up being that the hidden field was bound to the form. Not sure why this prevented me from setting the property, probably getting set to nothing after the onload in retrospect.. I actually ended up going with textboxes set to no border with white text. I support your conclusion about hidden fields not getting rendered. I have been living in the lan client too long..
[Reply][Quote]
Timmus Agersea
Posts: 328
 
Re: javascript not picking up hidden field valuesYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Apr 08 2:31 PM
Steve,

Just to clarify I am not stating hidden fields dont get rendered; controls with their visible property set to false dont get rendered. HiddenFields work flawlessly for us.

Also, what do you mean by "The problem ended up being that the hidden field was bound to the form". Again this works great for us so I am curious what problem(s) you have encountered. Thankfully you have found a work around but I dont believe a work around should be necessary.

Just curious...

Timmus
[Reply][Quote]
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
Re: javascript not picking up hidden field valuesYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Apr 08 2:38 PM
Bad wording on my part - not hidden fields (
[Reply][Quote]
Timmus Agersea
Posts: 328
 
Re: javascript not picking up hidden field valuesYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Apr 08 3:45 PM
Ahh, I am not developing in the Application Architect. This is a stand alone ASP.net application and I am not using databinding as ASP.net's databinding sucks. So with all the additional variables I would say we are not comparing apples to apples .

Using the Application Architect is most certainly a time consuming endeavor. I trust that Sage is making strides to improve the experience as it is currently very painful.

Thanks Steve!

Timmus
[Reply][Quote]
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
Re: javascript not picking up hidden field valuesYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Apr 08 3:51 PM
Just to come full circle, I started the form in AA and let slx map the fields. I then compiled and copied the smartpart to a new location then did the rest in VS. I mapped additional fields based on the SLX code. So kind of a hybrid.. but I still had to build/deploy in AA to test changes. Pain in the arse... I wonder if there is an easier way..
[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/22/2025 3:30:10 PM