Chuck
river guide Posts:157
|
11-29-2010 07:53 AM |
|
I have a field which only allows a user to input a value that may or may not include a decimal value. e.g. 1200 or 1200.00
I added a javascript which only allow users to input such type of entry only.
My question is that I am attempting when submitting that question value into an e-mail, I want to format it to a currency value... e.g. $1,200 or $1,200.00
So in my Submit/Save Javascript I have added this for my respective question field:
var field1 = $(L4onkeypress_FieldID);
document.getElementById(field1).value = formatCurrency(eval(parseFloat(document.getElementById(field1).value)));
I click on the Update the Javascript File link, but when I go back to the Submit/Save Javascript section, the entry I inputted is no longer there. It acts like it doesnt save it.
Also, the next question, will my approach work converting the value to a currency format in a e-mail output?
Thoughts?
Running DF Ver:3.3.40.0/ DNN 5.2.2
|
|
|
|
|
Ryan Bakerink
river guide Posts:1900
|
11-29-2010 09:25 AM |
|
Hello Chuck,
It looks like possibly the route you're taking is generating errors on the page which isn't allowing this to work how you initially intended.
I believe the syntax you're using is incorrect, due to the $(token) is basically document.getElementById(token).value.
So you're coding the same thing twice which would throw an error in JavaScript.
If you use FireFox please look into a plug-in named FireBug and use this to debug your JavaScript.
If you use IE, then there is something called Developer Tools.
If you have any questions please let us know,
Thanks,
Ryan |
|
|
|
|
Chuck
river guide Posts:157
|
11-29-2010 10:20 AM |
|
Hi Ryan,
So what would be the token syntax that can be passed using the Submit / Save Javascript?
As you said, I cant pass $(QuestionShortname_FieldID) or $(QuestionShortname)
Is it possible to pass a token to a function in the Submit/Save Javascript section? |
|
|
|
|
Ryan Bakerink
river guide Posts:1900
|
11-30-2010 02:17 PM |
|
Hello Chuck,
First of all I never stated that you couldn't use $(token_fieldID) - you can definitely use this if you'd like.
The issue that I see is:
var field1 = $(L4onkeypress_FieldID);
document.getElementById(field1).value = formatCurrency(eval(parseFloat(document.getElementById(field1).value)));
var field1 = $(yourToken_FieldID); ---- Ok good so far
document.getElementById(field1).value ------- Incorrect
NOTE: On the line I'm stating incorrect, this is basically what you're coding:
document.getElementById(document.getElementById($(yourToken_FieldID).value)).value
Do you see the error that's being invoked??
A token ----> $(shortFieldName) is:
document.getElementById(shortFieldName).value
So you're basically coding redundant which in this syntax with JavaScript, is not allowed.
If you have any questions please let me know.
Thanks,
Ryan
|
|
|
|
|
Chuck
river guide Posts:157
|
12-01-2010 05:03 AM |
|
Hi Ryan,
Thanks for your followup. I do what you are saying.
But can you help me out when you have time. You stated that I can still pass a $(Token_FieldID). I just want to make sure this is still valid in the SUBMIT/SAVE Javascript section.
I have a test page on the betasprings site:
http://www.betasprings.com/Dynamic-...fault.aspx
If you look at Line4, I define the token value in my SUBMIT/SAVE Javascript section, but when I submit the page, I still get a javascript error that it does not recognize the $(Token_FieldID)
Its a simple script just to make sure I dont have any errors in using it. It looks like this:
var field1 = $(Line4_FieldID);
alert('hello');
In theory, I should pass the token value into my var field1 and a simple alert box should pop up. But instead, I get a Javascript error on clicking the submit button that says: Line4_FieldID is undefined.
I appreciate your thoughts on this. I may still be misunderstanding the thought process.
Thanks again. |
|
|
|
|
Ryan Bakerink
river guide Posts:1900
|
12-02-2010 07:31 AM |
|
Hello Chuck,
I will take a look at your example, but we have been working on BetaSprings.com recently and the site is currently not up. Once it is I will jump in and take a look and help you out.
Thanks for your understanding.
Ryan |
|
|
|
|
Chuck
river guide Posts:157
|
12-06-2010 09:32 AM |
|
Hello Ryan,
I will look forward to what you have found out.
Thanks. |
|
|
|
|
Ryan Bakerink
river guide Posts:1900
|
12-07-2010 01:29 PM |
|
Hello Chuck,
Just so I understand completely, you'd like to see line 4 convert the total value to a dollar currency and then use this total amount with currency format to be used in an email completion event??
Please let me know specifically and briefly what your plans with the field "Line 4"
PS. I have taken a look and see what you're currently doing but I would like more details for my sake.
Thanks,
Ryan |
|
|
|
|
Chuck
river guide Posts:157
|
12-08-2010 04:57 AM |
|
Posted By Ryan Bakerink on 12/07/2010 3:29 PM
Hello Chuck,
Just so I understand completely, you'd like to see line 4 convert the total value to a dollar currency and then use this total amount with currency format to be used in an email completion event??
Please let me know specifically and briefly what your plans with the field "Line 4"
PS. I have taken a look and see what you're currently doing but I would like more details for my sake.
Thanks,
Ryan
Hello Ryan,
Actually, $(Line1) and $(Line2) and $(Total) was built for another use. I decided to use this same page to give you an example to work with from another question from the past. But that being said, your assumption on my goal is correct.
I would like a 'USER' to input a value in $(Line4), which most likely will be an integer value or a value with 2 decimal points. e.g. 1200 or 1200.00
But what I would like to do is display that value as currency format in an e-mail completion event. So basically on a SAVE/SUBMIT function, I would like to pass the QUESTION to a function that returns a currency value. I know I could use a method to do a client side event for that particular question on input to convert that value to a hidden field with a currency format. But I have so many input fields like that, I rather not create a slew of new hidden field questions also the reason I dont convert in the input box onkeypress, I have a couple of javascript function that does not allow the user input a $ or commas in the numeric inputs. e.g. see $(Line1) and $ (Line2). If I did allow that it throws an error in my automatic calculation for my $(Total).
So I thought it would be easier to pass that value to a currency function during the SUBMIT/SAVE
If you can provide a sample syntax on how I can pass the $(Token) to the SUBMIT/SAVE area, that would be great. I have tried different variations of $(Token_FieldID) or $(Token) and no luck. My simple function that I provide makes an attempt to pass my $(Line4_FieldID) and my page sees that as an invalid object.
I appreciate your assistance,
-Chuck |
|
|
|
|
Chuck
river guide Posts:157
|
12-16-2010 06:14 AM |
|
Hello Ryan, I know your a busy person but was wondering if you had a chance on looking at this? Thanks, Chuck |
|
|
|
|
Ryan Bakerink
river guide Posts:1900
|
12-16-2010 02:03 PM |
|
Hello Chuck, Yes I have looked at this, actually I responded to you in this forum thread but shortly after we had to do a backup on our forums do to us upgrading our Active Modules, and unfortunately my post wasn't included. I'm very sorry for this, and thank you for your patience. So lets get this resolved, I think this would be much easier to accomplish over the phone then through email threads. Would you like to setup a GoToMeeting to iron this out and get this working? Part of the difficulties at hand for me is understanding what direction you're taking with Line 4. I know you have provided plenty of useful information, but I believe this will be best resolved over the phone, and will prove to be more efficient in the amount of time it will take. Please let me know what day and what time would work for you. Possibly early next week? Thanks Chuck, Ryan |
|
|
|
|
Chuck
river guide Posts:157
|
12-17-2010 07:02 AM |
|
Ryan, That would be great. How about 11 am Central, Monday Dec. 20? I have a web conference tool to use. Send me an e-mail with your address and I will send you the information to use for our web conference. Thank you, Chuck |
|
|
|
|
Ryan Bakerink
river guide Posts:1900
|
12-22-2010 08:08 AM |
|
Hello Chuck, I'm very sorry for the late response once more, as you can imagine there are many different forms in which we are contacted and honestly forum threads are the last attended. I can setup a meeting tomorrow with you around 11:00AM Pacific Standard Time 12/23/2010 if this works for you? Please let me know, and by the way lets stay in contact through an email thread rather than a forum thread. I'll be sending this same message to you via email. Thanks for your understanding. Ryan |
|
|
|
|
Cris
new to the springs Posts:1
|
02-27-2011 08:17 PM |
|
Hi guys,
I would like to have a user alerted based on the answer to a combo box on submit. Here is what I have so far, could you please take a look and tell me what I'm doing wrong?
javascript:if($(Status_FieldID).value == 5){alert('test')} |
|
|
|
|
Ryan Bakerink
river guide Posts:1900
|
02-28-2011 07:18 AM |
|
Hello Cris,
The section where you can use JavaScript to fire upon successful form submission is under Module Configuration -> Custom JavaScript file.
Look for the text area box for submission JavaScript.
Also I would rearrange your JavaScript to something like this:
if($(Status) == 5) { alert('Test'); }
If you have any questions please let us know.
Thanks,
Ryan
|
|
|
|
|
Cris Ransdell
skipping stones Posts:4
|
02-28-2011 07:55 AM |
|
Okay, I added the script to that area of the Custom JavaScript file and I did not get an alert. When I look at the source of the page this is what I see for the Save button:
<td align="Left" valign="Top"><input type="image" name="dnn$ctr393$DynamicForms$ctl91" src="/Portals/0/Savebutton.png" onclick="if($(Status) == 5)
{
alert('Test');
};" style="border-width:0px;" /></td>
Status is the short text name of combo box that I am trying to retrieve the information from and 5 is the value that I am looking for. Any ideas on how to get this accomplished. |
|
|
|
|
Ryan Bakerink
river guide Posts:1900
|
02-28-2011 08:27 AM |
|
Hello Cris,
Just to see how this works I would recommend just placing a simple:
alert('this is a test');
Into the submission JavaScript section. Then you'll get the hang of how this works. Possibly, for testing purposes try using alerts with the value of the field that you're testing:
var test = '$(Status)'; alert(test);
Now you can see the value that is associated with the Status field on your form.
If you have any questions please let us know.
Thanks,
Ryan
|
|
|
|
|
Cris Ransdell
skipping stones Posts:4
|
02-28-2011 08:33 AM |
|
Tokens do not seem to work in that box. Is this correct? |
|
|
|
|
Ryan Bakerink
river guide Posts:1900
|
02-28-2011 08:49 AM |
|
Hello Cris,
What DNN version and Dynamic Forms version are you working on??
Yes tokens definitely work in this box, I made a typo in my JavaScript, try this as a test:
var test = $(Status);
alert(test);
If this doesn't bring up any value at all please let me know.
Thanks,
Ryan
|
|
|
|
|
Cris Ransdell
skipping stones Posts:4
|
02-28-2011 09:09 AM |
|
The alert is not even coming up now. I am using DNN 05.06.00 and DynamicForms 3.40.30. The ComboBox is being populated by SQL Driven Options that are showing up correctly and populating the value into my table correctly. |
|
|
|
|
Chuck
river guide Posts:157
|
02-28-2011 10:53 AM |
|
Posted By Cris Ransdell on 02-28-2011 11:09 AM
The alert is not even coming up now. I am using DNN 05.06.00 and DynamicForms 3.40.30. The ComboBox is being populated by SQL Driven Options that are showing up correctly and populating the value into my table correctly.
I think I was getting confused where you are putting your javascript.
As Ryan stated that you can put the javascript in the CUSTOM JAVASCRIPT section.
BUT only the sections, INITIAL JAVASCRIPT and JAVASCRIPT file can you use the $(token) to parse.
So if you are passing the $(token) in the SUBMIT/SAVE JAVASCRIPT function, Dynamic Forms will not recognize it.
The only way you can pass a field in that particular section is actually
going into the source code of the page and pull the actual ID of that
particular field.
So it might look like this for a combo box: id= "dnn_ctr487_DynamicForms_Responses_55e0d76f-8060-4375-8a1c-c2809d2b0f71"
So if you want to see the value the user selected upon clicking the
SUBMIT button, youll have to code the alert function in the SUBMIT/SAVE
JAVASCRIPT section as:
alert(document.getElementById("dnn_ctr487_DynamicForms_Responses_55e0d76f-8060-4375-8a1c-c2809d2b0f71").value)
NOTE: Remember, this is my example, so your combox id will look different. |
|
|
|
|
Cris Ransdell
skipping stones Posts:4
|
02-28-2011 11:05 AM |
|
Chuck and Ryan, Thank you guys so much! That last post worked perfectly for me! Cris |
|
|
|
|
Ryan Bakerink
river guide Posts:1900
|
03-30-2011 08:28 AM |
|
Hey Cris,
You're more than welcome, I'm glad that Chuck and myself could assist you in your needed solution.
If you ever have any questions please let us know.
Thanks,
Ryan
|
|
|
|
|
Elza
new to the springs Posts:3
|
04-14-2011 05:35 AM |
|
I added a javascript function to the dynamic registration module js file. Now i am trying to call the function from Submit / Save Javascript: I am passing the actual ID of the field that i need to manipulate. It is not even going to functions. I add an alert as the first line within the function but not giving any alerts. Could you please help me with this Thanks Elizabeth |
|
|
|
|
Elza
new to the springs Posts:3
|
04-14-2011 05:51 AM |
|
Hello, Never mind, i cleared the cache and now it is going to the function, but i am returning a false; so i expect that registration form will not submit; but it is submitting regardless it the value returned is true or false. |
|
|
|
|
Ryan Bakerink
river guide Posts:1900
|
04-14-2011 07:59 AM |
|
Hello Elza,
I'm assisting you by email, so let continue or discussion there.
If you have any questions please let me know.
Thanks,
Ryan
|
|
|
|
|
Elza
new to the springs Posts:3
|
04-14-2011 08:02 AM |
|
Ryan,
Sure, Thanks for your great support
|
|
|
|
|
Ryan Bakerink
river guide Posts:1900
|
04-15-2011 10:57 AM |
|
No problem Elza,
If any questions occur please let us know via email rather than the forums.
Thanks,
Ryan
|
|
|
|
|