[03:37:07] hello [03:37:23] hi jeremy [03:37:34] so we have a problem with radio buttons for amount [03:37:41] it seems that the way things were written in http://www.mediawiki.org/wiki/Special:Code/MediaWiki/101874 [03:37:48] and http://www.mediawiki.org/wiki/Special:Code/MediaWiki/101560 [03:38:03] are causing problems in certain situations [03:38:13] K4-713, can you explain the issue? [03:39:16] So, we're seeing issues where there is an explicit default of '0', particularly in the 'amount' field. [03:39:43] The problem with that, is that if 'amount' is anything, it will take precedence over any of the other amount-related values. [03:39:43] ok [03:40:00] do you know if it is a javascript or a PHP problem [03:40:38] Well, it's predictably a little hard to search for 'amount' in the DonationInterface extension... still trying to nail the whole thing down. [03:40:59] ok [03:41:05] But, we did find a couple instances where there did appear to be an explicit zero being set. [03:41:07] do you have a way to replicate it [03:41:13] it's sort of a combination of both, but mainly due to the amount field receiving a default value in the forms it looks like. [03:41:16] i am pretty familiar with that code [03:41:22] http://www.mediawiki.org/wiki/Special:Code/MediaWiki/101874 is one. [03:41:40] Which seems to be a bit of a re-write of http://www.mediawiki.org/wiki/Special:Code/MediaWiki/101560. [03:42:06] Have you been defaulting 'amount' (or any of the other numeric values) to an explicit zero anywhere else? [03:42:31] maybe in the js [03:42:53] there is a click and focus event [03:43:44] i have: [03:43:45] setAmount = function( e ) { [03:43:45] $('input[name="amount"]').val(e.val()); [03:43:45] }; [03:44:08] that's probably fine [03:44:23] here is more: [03:44:28] // Check to see if the element exists [03:44:28] if ( $("input[name='amountRadio']").length ) { [03:44:29] amountSelector = "input[name='amountRadio']"; [03:44:29] $( amountSelector ).click(function(){ setAmount($(this)); }); [03:44:30] $("#other-amount").focus(function(){ $('#input_amount_other').prop('checked', true); }); [03:44:30] $("#other-amount").change(function(){ setAmount($(this)); }); [03:44:31] } [03:44:45] looking right now... [03:44:57] Do we know what form we were getting these errors on? [03:45:04] no idea [03:45:17] I don't think the js in DonationInterface matters in this situtation though. The problem occurs when we are going to DonationsInterface from a first step page [03:45:20] does arthur or james? [03:45:25] james likely knows, although he seems to have disappeared [03:45:53] In those cases, an amount isn't necessarily passed [03:45:57] so does anyone know how to replicate it? [03:46:19] james is in the bathroom [03:46:23] James does [03:46:32] yeah, james should be able to tell you how to reproduce it [03:46:48] cool [03:46:59] i can work on that when he gets back [03:47:52] looking quickly through the code, it seems that you should be able to always rely on $this->form_data['amount'] [03:48:33] i made the radio form always populate the hidden amount field [03:48:46] that is done by javascript [03:48:56] repeating for james [03:48:57] i made the radio form always populate the hidden amount field [03:49:02] that is done by javascript [03:49:38] hi jamesofur [03:49:56] what form is not working? [03:50:21] for the radio button form [03:52:07] jpostlethwaite, the big one is https://payments.wikimedia.org/index.php/Special:GlobalCollectGateway?uselang=en&masthead=none&form_name=RapidHtml&ffname=webitects2nd . It appears to be happening when you have a session in place at some point. When I was on a first step (such as https://donate.wikimedia.org/wiki/Special:FundraiserLandingPage?uselang=en&country=AT&template=Lp-layout-default&appeal-template=Appeal-template-default&appeal=Appe [03:52:07] al-Alan&form-template=Form-template-default&form-countryspecific=Form-countryspecific-control&utm_medium=sitenotice&utm_source=B11_Donate_Alan_Control&utm_campaign=C11_1107 ) and entered an 'other' amount it would not get the amount fully passed [03:54:22] ok, i will need a few minutes to test this out [03:55:15] latest test I entered an amount (from that 1st step). Started the transaction and got an iframe then bailed (went back to 1st step). [03:55:55] If I select a radio button it gets passed as 'amount' and overwrites the old one. If I type something in the other box it does not overwrite the amount (and the 2nd step still has the old session amount from earlier) [03:56:57] jpostlethwaite: we're chatting irl about a potential solution [03:57:27] basically, on all of our forms on payments, we have javascript that will /always/ set a the 'amount' field [03:57:38] that however is not the case on some of the forms on wikimediafoundation.org or donate.wikimedia.org [03:57:53] but if we can potentially get that JS in use on wikimediafoundation.org/donate.wikimedia.org might solve the problem [03:58:12] since the logic inside of DonationData:setNormalizedAmount() will /always/ give preference to the 'amount' field [03:58:59] ok [03:59:07] i am seeing a problem with amount [03:59:18] that seems unrelated [03:59:44] https://payments.wikimedia.org/index.php/Special:GlobalCollectGateway?uselang=en&masthead=none&form_name=RapidHtml&ffname=webitects2nd [03:59:55] that page is missing the amount section [04:00:01] Donation amount () [04:00:04] jpostlethwaite: yes, it is a second step form [04:00:09] okay [04:00:17] which is the first step? [04:00:24] we are going to add some fallback, but it expects a passed value [04:00:30] some form on donatewiki [04:00:33] i see [04:00:59] the stuff that was pointed out in changes I made does not touch RapidHtml does it? [04:01:20] referring to: [04:01:21] http://www.mediawiki.org/wiki/Special:Code/MediaWiki/101560 [04:01:26] generateAmountByRadio() [04:01:29] RapidHTML is an extension of the form RapidHTML which extends Form [04:01:36] ok [04:01:59] but, that is as deep as I have gotten into DonationInterface due to lack of time [04:02:07] ok [04:02:58] this form is the first: [04:02:59] http://tinyurl.com/c3pq5k5 [04:03:26] I do not have this special page: [04:03:27] Special:FundraiserLandingPage [04:03:45] does anyone know how to get that on my local machine for testing? [04:03:46] jpostlethwaite: sorry, lots of IRL convo going on here [04:03:53] ok [04:04:12] but i think we've determined that your radio button generating stuff in Form.php is not the problem [04:04:25] ok [04:04:37] what does IRL mean? :) [04:05:14] in real life :) [04:05:15] in real life :) [04:05:18] ok [04:05:24] though so :P [04:05:27] haha [04:09:49] jpostlethwaite: we're trying to identify whether or not the theory about broken JS being the culprit is correct [04:09:56] and if it getting fixed will solve the problem :p [04:10:01] i see [04:10:31] feel free to pull code from the validate.js [04:10:35] the gist of what we just discussed is that it should be expected that DonationInterface will expect consistent data - it should only have to expect 'amount'. not amountOther, amountGive AND amount [04:10:48] right [04:10:50] no, the JS in question is on foundation wiki and/or donate wiki [04:11:20] anyway, even though we had the code in DI to handle amountOther, amountGive AND amount, the way we had things written in our forms last year was such that the only thing ever coming into DI was 'amount' [04:11:26] i meant just pull the methof [04:11:37] i see [04:11:44] we just never cleaned the cruft out of DI [04:12:02] and we think the JS already exists on foundation/donate wikis but is likely incorrectly scoped [04:12:25] any reason that amountRadio cannot just be amount? [04:12:47] anyway, i think we can take a deep breath and know that we're close to getting this sorted [04:13:01] i only did it with amountRadio because that is what was done before [04:13:06] yeah, i think that's fine [04:13:10] you just then need to verify that one is checked [04:13:12] cool [04:13:27] will you have more issues to solve tonight? [04:13:33] like i said, im pretty sure the stuff you added in Form.php is not the problem. [04:13:43] right [04:13:47] because im pretty sure the only thing using that method anyway is your TwoStepAmount form :p [04:13:59] which is not live in production [04:14:00] right, that is what I thought [04:14:18] are you going to be around for a bit? [04:14:21] yes [04:14:23] ok cool [04:15:25] cool - sounds like james has confirmed that the problem is busted JS on donate wiki [04:15:41] which means, SEP [04:15:49] what is SEP? [04:15:51] :) [04:15:56] Somebody Else's Problem [04:15:59] haha [04:16:07] :p [04:16:39] jpostlethwaite: thanks for hopping on, apologies about the confusion [04:16:47] no worries [04:17:02] the problem is an edge case, but kinduva big edgecase [04:17:27] concerning enough that all the forms were taken down until we got this solved, so there was some panic [04:17:58] i see [04:47:48] jpostlethwaite: I think we have the amount issue fixed for now [04:48:09] fixed it in the donation wiki templates