Great Ideas. Always Flowing.

We are not happy until you are happy. Client satisfaction guaranteed. Whatever your needs and requirements, we have the skills and resources for the job!

Quick login...


Or... now make it easy with Facebook Integration
Connect via Facebook



Top Sellers

Frustrated over the lack of customization for your user's registration fields? Dynamically setup your DNN Portal with custom registration fields, layout, questions, and other core integration options......

Ultra Video Gallery is a brother product of Ultra Media Gallery, UVG allows you to upload videos in various format and automatically encode them to flv or H264 format, you also can add videos from internet or record live videos from your webcam.

Build high performance, completely customizable data-entry forms and views driven by your DNN and external databases. New built-in tools make it a snap to quickly create data entry forms, data views, and even database tables. Plus, add your own HTML, CSS, Javascript, SQL commands, stored procedures,

The most advanced DotNetNuke shopping cart on the planet. Easy to use e-Commerce, Secure Shopping Cart Software and SEO friendly. B2C / B2B Ecommerce Sites.

One stop solution for events calendar and events registration! FREE DOWNLOAD is available now!

Client Side Event - Character Limitation?
Last Post 11-01-2010 09:37 AM by Chuck. 14 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
ChuckUser is Offline
river guide
river guide
Posts:157
Avatar

--
10-18-2010 04:57 AM
    I have a client side event that looks like this:

    {
    if(isNaN($(Line18LL1Numonkeypress))){
    $(Line18LL1Numonkeypress) = '0';
    }
    else
    {
    $(hiddenTotal_LL_Discount1) = (parseInt($(Line18LL1Numonkeypress)) * parseFloat($(Line18Discount1onkeypress))).toFixed(2)
    $(Line18TotalLLDiscount1) = formatCurrency(eval(parseFloat($(hiddenTotal_LL_Discount1))))
    $(hiddenTotal_LL_Discount2) = (parseInt($(Line18LL2Numonkeypress)) * parseFloat($(Line18Discount2onkeypress))).toFixed(2)
    $(Line18TotalLLDiscount2) = formatCurrency(eval(parseFloat($(hiddenTotal_LL_Discount2))))
    $(Line18TotalLLDiscount) = formatCurrency(eval(parseFloat($(hiddenTotal_LL_Discount1)) + parseFloat($(hiddenTotal_LL_Discount2))))
    $(Line18TotalLLNumber) = parseInt($(Line18LL1Numonkeypress)) + parseInt($(Line18LL2Numonkeypress))
    $(hiddenTotal_LL_Discount) = parseFloat($(hiddenTotal_LL_Discount1)) + parseFloat($(hiddenTotal_LL_Discount2))
    $(Line18) = formatCurrency(eval(parseFloat($(hiddenTotal_LL_Discount1)) + parseFloat($(hiddenTotal_LL_Discount2))))
    }
    }

    But for some reason it omits parts of it...see below which I highlighted in red.  Is there a way around this?

    {
    if(isNaN($(Line18LL1Numonkeypress))){
    $(Line18LL1Numonkeypress) = '0';
    }
    else
    {
    $(hiddenTotal_LL_Discount1) = (parseInt($(Line18LL1Numonkeypress)) * parseFloat($(Line18Discount1onkeypress))).toFixed(2)
    $(Line18TotalLLDiscount1) = formatCurrency(eval(parseFloat($(hiddenTotal_LL_Discount1))))
    $(hiddenTotal_LL_Discount2) = (parseInt($(Line18LL2Numonkeypress)) * parseFloat($(Line18Discount2onkeypress))).toFixed(2)
    $(Line18TotalLLDiscount2) = formatCurrency(eval(parseFloat($(hiddenTotal_LL_Discount2))))
    $(Line18TotalLLDiscount) = formatCurrency(eval(parseFloat($(hiddenTotal_LL_Discount1)) + parseFloat($(hiddenTotal_LL_Discount2))))
    $(Line18TotalLLNumber) = parseInt($(Line18LL1Numonkeypress)) + parseInt($(Line18LL2Numonkeypress))
    $(hiddenTotal_LL_Discount) = parseFloat($(hiddenTotal_LL_Discount1)) + parseFloat($(hiddenTotal_LL_Discount2))$(Line18) = formatCurrency(eval(parseFloat($(hiddenTotal_LL_Discount1)) + parseFloat($(hiddenTotal_LL_Discount2))))
    }
    }
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    10-18-2010 08:59 AM
    Hello Chuck,

    For a work around I would make this code into a function with all of your javascript and add this to Module Configuration -> Custom JavaScript file and add this newly created function into this area and remove it from the Client Side Event section and place the name of your function in the client side event.

    So instead of your long JavaScript I would place the name of the function like so:

    yourFunctionName();

    When you call the function from the client side event automatically the program will look into the Custom JavaScript file to see if it can find the function and if it can then the code will be executed.

    If you have any questions please let me know.

    Thanks,

    Ryan
    ChuckUser is Offline
    river guide
    river guide
    Posts:157
    Avatar

    --
    10-18-2010 09:46 AM
    Posted By Ryan Bakerink on 10/18/2010 10:59 AM
    Hello Chuck,

    For a work around I would make this code into a function with all of your javascript and add this to Module Configuration -> Custom JavaScript file and add this newly created function into this area and remove it from the Client Side Event section and place the name of your function in the client side event.

    So instead of your long JavaScript I would place the name of the function like so:

    yourFunctionName();

    When you call the function from the client side event automatically the program will look into the Custom JavaScript file to see if it can find the function and if it can then the code will be executed.

    If you have any questions please let me know.

    Thanks,

    Ryan
    That makes sense.  Can you provide a simple example where you call a JS function , then within it reference the results and populate the various shortname form fields.  As you can see in my example I provided, I am populating 7 form fields in a calcuation.  How do I reference them in Javascript?

    Thanks.

    ChuckUser is Offline
    river guide
    river guide
    Posts:157
    Avatar

    --
    10-19-2010 07:41 AM
    I would appreciate if you can give a simple example on how to reference and set a value via using a javascript function.

    Thanks.
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    10-21-2010 07:45 AM
    Hello Chuck,

    If you're trying to set a value into another field from a field, you can do this by going into the field options and in the "Client Side Event" text area box you can use a token and set it.

    Like this:

    $(TheFieldYourSettingAValue) = 'Whatever you want'

    You can use this however you'd like for your advantage.

    If you have any questions please let us know.

    Thanks,

    Ryan
    ChuckUser is Offline
    river guide
    river guide
    Posts:157
    Avatar

    --
    10-21-2010 07:52 AM
    Posted By Ryan Bakerink on 10/21/2010 9:45 AM
    Hello Chuck,

    If you're trying to set a value into another field from a field, you can do this by going into the field options and in the "Client Side Event" text area box you can use a token and set it.

    Like this:

    $(TheFieldYourSettingAValue) = 'Whatever you want'

    You can use this however you'd like for your advantage.

    If you have any questions please let us know.

    Thanks,

    Ryan
    Hi Ryan,
    Thanks for your reply.
    Yes, I was already doing that.  I was setting that in my original post, but I was running into a character limitation of trying to set many form variables in the client side event.  You suggested using a function to call in the client side event, but I didnt know how to reference the form field variables in the function when I am in Custom JavaScript file area.

    Appreciate a followup.
    ChuckUser is Offline
    river guide
    river guide
    Posts:157
    Avatar

    --
    10-22-2010 01:07 PM
    Hello Ryan,
    I was wondering if you can follow-up on my last comment.  I was hoping it wouldnt be hard to provide something to look at.

    All I am trying to accomplish is to use a function in my client side event and define the function in the Custom Javascript area.

    I just need a simple example on how I can assign a value in the Custom Javascript area.  Lets say in my form I have a shortname called "Line18"

    How would I assign a value to Line18 in my function?
    In my example I have tried this:
    document.getElementById('$(Line18_FieldID)').value) = 5;

    But it does not work.   I have tried various variations too.  As I stated in my previous post, I have a lot of form variables to assign  based on other form inputs but I am running into a character limitation when I try to do all that in the Client Side event.

    I would appreciate a followup.
    Thanks.
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    10-25-2010 12:58 PM
    Hello Chuck,

    To define a value you can do this in the question itself in the section On Client side event. You can say

    myFunction($(Line18) )

    Then after that line of code you can pass that value to a function that resides in your Custom JavaScript File like this:

    function myFunction(valueBeingPassed)
    {
        then you can use this valueBeingPassed with your JavaScript
    }

    Also you might want to try this:
    document.getElementById('$(Line18_FieldID)').value)

    like this:

    document.getElementById($(Line18_FieldID)).value = 5

    If you have any questions please let us know.

    Thanks,

    Ryan
    ChuckUser is Offline
    river guide
    river guide
    Posts:157
    Avatar

    --
    10-26-2010 05:07 AM
    Posted By Ryan Bakerink on 10/25/2010 2:58 PM

    myFunction($(Line18) )

    Then after that line of code you can pass that value to a function that resides in your Custom JavaScript File like this:

    function myFunction(valueBeingPassed)
    {
        then you can use this valueBeingPassed with your JavaScript
    }

    Hi Ryan, thanks for the followup but its not exactly my solution.  That solution I know that you provided works and I am familiar with it.

    Posted By Ryan Bakerink on 10/25/2010 2:58 PM

    document.getElementById($(Line18_FieldID)).value = 5
    This solution I am familiar and have used it but it only works in the CLIENT SIDE EVENT.  Is their anyway to call a function without passing a shortname value but assign a value of the shortname within the function?

    -- This is called in the CLIENT SIDE EVENT of the Question
    myfunction()

    -- In the  MODULE CONFIGURATION | CUSTOM JAVASCRIPT FILE | JAVASCRIPT FILE, I have a function called myfunction().  But in that function, I dont want to pass a variable into the function, but want to assign a shortname question value within e.g. $(Line18).  How do I reference it without passing a value into the function?  I assume you would use a document.getElementById sysntax, but that is where I am having a problem finding the correct name being used by dynamic forms for my shortname question value of $(Line18).

    myfunction () {
    How do I set my $(Line18) value?
    }


    I know its not good coding practice to assign a value of a shortname if I dont pass the variable in the function for it, but in my case, I have a form which I have a lot of calculations like in my original post above but ran into character limitations.

    I know once I can correctly reference the shortname field ID in my function, I can finish out my calculations.

    I appreciate your feedback.  I have been stuck on this for over a week now and its frustrating.
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    10-26-2010 09:37 AM
    Hello Chuck,

    Just to keep in mind, what ever you use for the shortname of the field you provide, this becomes the ID for the field.

    So lets say I have a hidden field in which I provided a short name as Value1

    Then in the JavaScript function I can reference this field by saying:

    document.getElementById('Value1').value = '5'   --- assigning a string value

    or

    document.getElementById('Value1').value = 5 -- a number value.


    Either way you can use the parseFloat or parseInt JavaScript method to convert it to the data type you'd like.

    So please let me know how this helps you.

    Thanks,

    Ryan
    ChuckUser is Offline
    river guide
    river guide
    Posts:157
    Avatar

    --
    10-27-2010 06:08 AM
    Posted By Ryan Bakerink on 10/26/2010 11:37 AM
    Hello Chuck,

    document.getElementById('Value1').value = '5'   --- assigning a string value
    or

    document.getElementById('Value1').value = 5 -- a number value.

    Hello Ryan,
    I have followed your example in the Custom Javascript area in my module and it still does not reflect the proper values.  I have created an example in the betasprings site.  It is at:
    http://www.betasprings.com/Dynamic-...fault.aspx

    I have created two input boxes, upon entering a value it will call a function on the CLIENT SIDE event called testFunction

    In the Custom Javascript section, the function testFunction has an alert statement executed.  I put it there to make sure my function does execute.  If you would be kind enough to code in that function to set my shortname fields $(value1) and $(value2) to 10 and 15 appropriately.  Please do not change the function where I am passing the two values via using a parameter.  I already know how to do that.  I  just want to directly code a value by using their respective formID and set it.

    I appreciate and await for your reply.  Thanks again.

    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    10-27-2010 10:24 AM
    Hello Chuck,

    Unfortunately I can't spend too much time implementing this JavaScript for you, so I have made the minimal modifications needed to get the values put into the textbox via JavaScript.

    If you look in the source code of the page you can find the ID of the text boxes on the form and use that like this in your function:

    document.getElementById('dnn_ctr2308_DynamicForms_TBR_GUID263498be-c77b-431a-aa5d-535125c8db3cValue1').value= 5;

    Here's your page:

    http://www.betasprings.com/Dynamic-...fault.aspx

    If you have any questions please let me know.

    Thanks Chuck,

    Ryan
    ChuckUser is Offline
    river guide
    river guide
    Posts:157
    Avatar

    --
    11-01-2010 07:15 AM
    Posted By Ryan Bakerink on 10/27/2010 12:24 PM
    Hello Chuck,

    Unfortunately I can't spend too much time implementing this JavaScript for you, so I have made the minimal modifications needed to get the values put into the textbox via JavaScript.

    If you look in the source code of the page you can find the ID of the text boxes on the form and use that like this in your function:

    document.getElementById('dnn_ctr2308_DynamicForms_TBR_GUID263498be-c77b-431a-aa5d-535125c8db3cValue1').value= 5;

    Here's your page:

    http://www.betasprings.com/Dynamic-...fault.aspx" target="_blank" rel="nofollow">http://www.betasprings.com/Dynamic-...fault.aspx

    If you have any questions please let me know.

    Thanks Chuck,

    Ryan

    Ryan, I appreciate the reply.  But its still not what I am looking for.  I do understand you are busy but I dont think its would be hard to give me a one line syntax to identify a field, but I could be wrong in my assumption.  Yes its easy just to identify the actual ID of the shortname by using the source code.  But if I want to create the form in another module, I dont want to keep having to revert to trying to find the ID by looking at the source constantly to reach my goals.

    I know in the initial javascript I can identify my field ID by coding:
    var value1 = $(value1_FieldID)
    document.getElementById(value1).value = 123

    On load of the form it will let me set my shortname Value1 field to 123

    BUT, let me specific again, if I have a function in the in the CUSTOM JAVASCRIPT as a function and I call a function from my CLIENT SIDE event WITHOUT passing a parameter and I want to set a value to shortname, How do I identify it?

    If we use our example above of value1, in the function called testFunction()
    BTW, I am using the same betasprings page, to reflect the coding change for my example.

    http://www.betasprings.com/Dynamic-...fault.aspx" target="_blank" rel="nofollow">http://www.betasprings.com/Dynamic-...fault.aspx

    function testFunction(){
    var value1 = $(value1_FieldID)
    document.getElementById(value1).value = 12345;
    }

    Why is that in the module, it works in the INITIAL JAVASCRIPT section, but does not work in the JAVASCRIPT FILE?

    I appreciate a clarification,
    Chuck
    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    11-01-2010 07:55 AM
    Hi Chuck - Unfortunately the Custom JavaScript File is a custom file that is saved on the server (and not rendered) so you would need to find the ID and then hard code it. You can use FireBug to hover over or view the source to find the ID of the field but you would still need hard code it into the custom JavaScript file and there really isn't a way or $(Token) around that because its not parsed during execution... You could include the function in the initial JavaScript that IS parsed but not in the initial JavaScript file.

    The best option? Pass the field to the function:

    function testFunction(varYourFieldID){
    var value1 =varYourFieldID
    document.getElementById(value1).value = 12345;
    }


    Then... Whenever you call that function you pass in the short field name field ID... You can do this instead of using $(Field) by using $(Field_FieldID)

    testFunction($(ShortField_FieldID))


    Hope this helps!

    -Chad


    Example:


    ChuckUser is Offline
    river guide
    river guide
    Posts:157
    Avatar

    --
    11-01-2010 09:37 AM
    Posted By Chad Nash on 11/01/2010 9:55 AM
    Hi Chuck - Unfortunately the Custom JavaScript File is a custom file that is saved on the server (and not rendered) so you would need to find the ID and then hard code it. You can use FireBug to hover over or view the source to find the ID of the field but you would still need hard code it into the custom JavaScript file and there really isn't a way or $(Token) around that because its not parsed during execution... You could include the function in the initial JavaScript that IS parsed but not in the initial JavaScript file.

    The best option? Pass the field to the function:

    function testFunction(varYourFieldID){
    var value1 =varYourFieldID
    document.getElementById(value1).value = 12345;
    }


    Then... Whenever you call that function you pass in the short field name field ID... You can do this instead of using $(Field) by using $(Field_FieldID)

    testFunction($(ShortField_FieldID))


    Hope this helps!

    -Chad


    Example:


    Thanks Chad for that clarification.  It makes sense to me.  I know Ryan was providing me with the same solution and I understood it, but I didnt know if their was another option available using a function without a parameter.  As you can see what prompted me on my original post was my problem passing a lot of variables using a a lot of shortname parameters, but ran into a problem when I exceeded a character limitation in my client side event script.  Ill have to go back and see what I can do to fix passing all these shortname variables.  I may have to shorten the field names is a possiblity.

    Just to give you an idea, what I was trying to accomplish is that I have a form, with a lot of input fields for a user to enter a numeric value.

    e.g.  Question 1-5 sums a total, 6-10 sums a total, 11-13 sums a total, Question 14 subtracts its number from a total.  Question 15 is grandtotal.  I am displaying subtotals for each one but also have hidden totals to use for my calculations.  As you can see I have more questions to add for input.  What I wanted to make sure is that if the User goes back and revises a number, it would run a client side event to recalc.  Hope this made sense.

    Thanks again all.
    You are not authorized to post a reply.


     
     

    Join our mailing list...

    Get current news and events the easy way
    Subscribe Me

    Recent Blogs...

     
    Copyright 2005 - 2011 by Data Springs, Inc.
     
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi