Troy Posts:68
 river guide
 |
| 12/05/2008 8:37 AM |
|
After hours of troubleshooting I have discovered that when I have the paypal gateway enabled and use the $(myshortfieldname_text) token with several completion events my checkbox group values get passed as the question option values...when I disable the paypal gateway, the question option text is used. I am using two completion events..one is an email event and the other is a sql event. I am wondering if this is by design?
Thanks,
Troy
|
|
|
|
|
Candace Posts:229
 river guide
 |
| 12/05/2008 9:57 AM |
|
Hi Troy,
Are you able to duplicate this over at betasprings.com (please use host / dnnhost to login)? Let us know your page name so we can review this further. Thanks.
Candace |
|
|
|
|
Troy Posts:68
 river guide
 |
| 12/05/2008 12:14 PM |
|
Candace,
I was able to duplicate this on betasprings.com. You can find my page I created here. All I did to reproduce the problem was to enable the PayPal gateway, fill the form out and save it. I then disabled the PayPal gateway and fill the form out again. The form sends an email to the email address you provide in the form. I will email you my sandbox info...
Troy |
|
|
|
|
Candace Posts:229
 river guide
 |
| 12/05/2008 12:16 PM |
|
Thanks, Troy. I will wait for your Sandbox login and start testing. Candace |
|
|
|
|
Shawn Posts:39
 paddling down the creek
 |
| 12/10/2008 6:57 PM |
|
| I'm getting the same problem. Disable Paypal mode everything works great. Turn it on and it breaks. For a radio button, using $(FieldName) and $(FieldName_Text) both return only the "update option value". The Paypal process works fine, but where I have an issue is with the email that users are supposed to recieve upon the IPN completion event. This is kind of a big deal since I'm not able to return in the body of the email confirmation the details for what was selected. |
|
|
|
|
Shawn Posts:39
 paddling down the creek
 |
| 12/10/2008 11:39 PM |
|
I thought as a work around that perhaps setting a hidden field to capture the label text of the radio button would work, but I can't figure out how to make that happen. I see you have a javascript function that will capture the radio button value, but nothing for the text.
Any ideas or other workarounds or better yet -- a patch to fix the original issue? |
|
|
|
|
Chad Posts:2389
 river guide
 |
| 12/12/2008 4:52 PM |
|
Hi guys... Yes we have been able to confirm that the feature for including the text of field options within events does not work properly when implemented with PayPal. Basically when this feature was added it relies on the form field to actually exist on the form in order to get the text of that specific field option/attribute. The text property is never actually saved to the database which is why its also not avaliable for example in the 'View Results' area. So the short version goes... the text property is never stored in the database and therefore its not avaliable for events related to the PayPal IPN because all of these events pull the users responses from the database. We might be able to later add the functionality where if you are using the events and PayPAl IPN possibly checking the actual DynamicForms_QuestionOption table and getting the text property for the value from there (even more trouble if you are using SQL Options though). Either way, its not currently a feature that you can use for PayPal events because of these reasons...
So... Finding a work around... Hmmm... Fun.... Your suggestion is good suggestion, although a quick search on JavaScript functions really doesn't return many results for pulling in the Radio Button Text, most of them pull in the value. So, if you had a limited number of radio button options you could always use an if statement to return the text. For example...
if (GetRadioButtonValue(id) == 'Red')
return 'Color Red Text'
else if (GetRadioButtonValue(id) == 'Red')
return 'Color Blue Text' etc...
That would be option #1
I think option #2 might be easier though, just need to get the right syntax, but I think its a better solution with less room for error. Option #2 would be to create a SQL Completion Event, and setup that completion event to fire 'before PayPal Redirection'. In this solution you would still have to reference a hidden field on the form, but you could set the hidden field value from the SQL Event, and you should be able to reference the $(Field_Text) property because the form as not yet submitted to PayPal. Here is what I think the code would look like...
Update DynamicForms_QuestionResponse
Set Response = '$(YourField_Text)'
Where DynamicQuestionID = (Select DynamicQuestionID from DynamicForms_Question where ShortFieldName = 'MyHiddenField')
AND UniqueResponseID = '$(UniqueCompletionID)'
So basically both options are handling your same suggestion, however one is handling it on the client side before submission and the other is on the server side but before the redirection to PayPal takes place.
If you end up using either of these please post your solution or continued question as I am sure other users will need this same work around.
-Chad |
|
|
|
|
Shawn Posts:39
 paddling down the creek
 |
| 12/14/2008 12:23 PM |
|
Thanks for your response. I guess both suggestions will work -- I'll probably opt for suggestion #1 as it doesn't require another round trip to the server. I preper client side events as opposed to server side as it seems confusing for the end user -- they don't understand the delay and sometimes that causes an issue with the useability of the form. Looking into this further though - - I think it would be possible to create a function that would get this info. The text values we want to capture is the text between the label elements for each node of a radio button checklist or drop downlist. It seems like you could first find the elementid or elementid and tag id, and then grab the innerHTML or node value for the label that corresponds to the radio button selection. Unfortunately my javascript skills just can't seem to get it together properly. |
|
|
|
|
Chad Posts:2389
 river guide
 |
| 12/16/2008 1:14 PM |
|
Thanks... If you end up using either route please post the solution as it will help other users. I recommend using FireFug for FireFox as this helps us in debugging and testing client side events / JavaScript but there is no easy answer. At heart I am more ASP.NET / SQL skilled then JavaScript skilled... I have always found it hard to debug JavaScript as its also extremely case sensitive... -Chad |
|
|
|
|
Troy Posts:68
 river guide
 |
| 12/20/2008 9:56 AM |
|
| I have been trying to implement option #2 above and I have noticed that the $(Field_Text) property does not work properly regarless if the the event fires before or after the form is submitted to paypal. |
|
|
|
|
Chad Posts:2389
 river guide
 |
| 12/20/2008 12:30 PM |
|
Does it not get replaced at all or is it getting replace with a blank? What field type is this, radio button, or dropdownlist? -Chad |
|
|
|
|
Troy Posts:68
 river guide
 |
| 12/29/2008 12:09 PM |
|
All, I FINALLY have this working. I modified the CalculateCheckBoxListValues fuction (found under Module Configuration>Custom Javascript File) for my needs...your needs may vary. You may want to copy and rename the function because the original function only accepted 2 parameters and it will error if you do not supply a valid HiddenFieldId parameter. After you have placed the function below in the custom javascript file you will need to call the function.... go to your Checkbox Group question settings>advanced settings>client side events and copy/paste the following: CalculateCheckBoxListValues($(CheckboxGroupShortName_FieldID), $(CheckboxGroupShortName_ValueFieldID), $(HiddenFieldShortName_FieldID)) **if you renamed the function to something other than CalculateCheckBoxListValues, you will need to change it before you save your Checkbox group question! Replace the CheckboxGroupShortName and HiddentFieldShortName text above with your short field names. Make sure you do NOT remove the _ValueFieldID and _FieldID text. Save your changes, make sure to refresh your form and you should be able to populate the label text of the selected checkbox group items in your hidden filed with PayPal enabled. FYI...the text is delimited with a single pipe... | ...you could change that to something else if you like. You would need to alter the following line in the javascript function: txt += objChkBoxes.nextSibling.outerText + ' | '; //modified CalculateCheckBoxListValues javascript function function CalculateCheckBoxListValues(CheckBoxList, CheckBoxValField, HiddenFieldId) { var objChkBoxLst = document.getElementById(CheckBoxList); var objChkBoxVals = document.getElementById(CheckBoxValField); var arrChkBoxVals = ''; if(objChkBoxVals) arrChkBoxVals = objChkBoxVals.value.split('|'); if(objChkBoxLst) { var objChkBoxes = objChkBoxLst.getElementsByTagName('input'); var i; var numSum = 0; var txt = ''; for(i=0;i if(objChkBoxes.checked) { numSum += GetCBValue(i, arrChkBoxVals); txt += objChkBoxes.nextSibling.outerText + ' | '; } } } numSum = Math.round(numSum * 100)/100; document.getElementById(HiddenFieldId).value = txt; return (numSum); } |
|
|
|
|
Chad Posts:2389
 river guide
 |
| 12/30/2008 7:10 PM |
|
THANK YOU!!!!!! Troy... I just wanted to say thanks for posting this solution and working with us on the issue. Sometimes 'features' like this can be limited with the PayPal IPN and your solution will likely help many other users. We will also review adding this JavaScript function call in the default JavaScript file in the next release of the module. Chad |
|
|
|
|
Troy Posts:68
 river guide
 |
| 12/31/2008 5:34 AM |
|
Chad, No problem! You and Candace have gone out of your way to help me many times so I am glad to help when I can. Troy |
|
|
|
|