CraigA Posted August 21, 2013 Report Posted August 21, 2013 WRT: http://www.blesta.com/forums/index.php?/topic/807-checkout-with-custom-field/ After applying Cody's fix, I now get error:CustomFieldName is in an invalid format. My field asks for an IP address. I've used these two regex's /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/ and /\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/ both of these work once a client is created manually, just not when they try and checkout and create an account. Not sure if bug so I posted it here first. Ideas?
Michael Posted August 21, 2013 Report Posted August 21, 2013 Try this mate: /^\(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/I'm only guessing though since i'm not the best at these.
CraigA Posted August 21, 2013 Author Report Posted August 21, 2013 That does not work in either scenario (when the client is created manually and then updates their info, or trying to check out as a new customer) The two regex's I posted work when a client is already created and updates their information. It just generates and invalid message during checkout with new clients.
Michael Posted August 21, 2013 Report Posted August 21, 2013 That does not work in either scenario (when the client is created manually and then updates their info, or trying to check out as a new customer) The two regex's I posted work when a client is already created and updates their information. It just generates and invalid message during checkout with new clients. Try this mate: ^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$ That one looks more like the one I use for the date of birth.
CraigA Posted August 21, 2013 Author Report Posted August 21, 2013 I had to wrap that in // for it to work with existing clients, but still errors out on using the order form to create a new client account
Michael Posted August 21, 2013 Report Posted August 21, 2013 I had to wrap that in // for it to work with existing clients, but still errors out on using the order form to create a new client account I'll try it on my side.
Michael Posted August 21, 2013 Report Posted August 21, 2013 I had to wrap that in // for it to work with existing clients, but still errors out on using the order form to create a new client account What errors do you get? I keep getting errors on this one field it's winding me up, however the IP one works fine and my date of birth it's just this one field called "How did you hear about us?" It's the first one on the form. (Is yours first?) I get this error: How did you hear about us? is set to an invalid value. How did you hear about us? is in an invalid format. on: http://billing.licensecart.com/plugin/order/main/signup/register But it's a dropdown box with values in it. preview video: http://screencast.com/t/8XuBkxOvCjNN
CraigA Posted August 21, 2013 Author Report Posted August 21, 2013 Yes, mine is the first (and only) one on the form. Michael 1
Michael Posted August 21, 2013 Report Posted August 21, 2013 Yes, mine is the first (and only) one on the form. Bet that's the issue haha just need Paul, Cody or Tyson to confirm this and hope they issue a fix lol.
Tyson Posted August 21, 2013 Report Posted August 21, 2013 Sounds like a bug with how the order form passes custom field values for validation. I believe custom fields are validated one at a time, so even if all of them are erroneous, only the first error would show. Michael 1
CraigA Posted August 21, 2013 Author Report Posted August 21, 2013 Sounds like a bug with how the order form passes custom field values for validation. I believe custom fields are validated one at a time, so even if all of them are erroneous, only the first error would show. This could be true. Just wanted to note that mine shouldn't be erroring at all. It works fine when editing "My Info" once the account is already created.
Michael Posted August 21, 2013 Report Posted August 21, 2013 Sounds like a bug with how the order form passes custom field values for validation. I believe custom fields are validated one at a time, so even if all of them are erroneous, only the first error would show. What would be the best way to go about this until the 3.0.1 mate? make a blank field for the first or will it still show a error? Or shall we just disable them all now haha.
eversmile_host Posted August 21, 2013 Report Posted August 21, 2013 What would be the best way to go about this until the 3.0.1 mate? make a blank field for the first or will it still show a error? Or shall we just disable them all now haha. i did the same
CraigA Posted August 21, 2013 Author Report Posted August 21, 2013 This custom field is the cornerstone of my business lol. I can't disable it. I'm supposed to launch in less than 2 hours :'(
Tyson Posted August 21, 2013 Report Posted August 21, 2013 I think Cody's fix from the other thread should be update /app/models/clients.php (line 89): $this->setCustomField($field->name, $client_id, isset($vars['custom']) && array_key_exists($field->name, $vars['custom']) ? $vars['custom'][$field->name] : null); to $this->setCustomField($field->id, $client_id, isset($vars['custom']) && array_key_exists($field->id, $vars['custom']) ? $vars['custom'][$field->id] : null); Michael 1
CraigA Posted August 21, 2013 Author Report Posted August 21, 2013 I think Cody's fix from the other thread should be update /app/models/clients.php (line 89): $this->setCustomField($field->name, $client_id, isset($vars['custom']) && array_key_exists($field->name, $vars['custom']) ? $vars['custom'][$field->name] : null); to $this->setCustomField($field->id, $client_id, isset($vars['custom']) && array_key_exists($field->id, $vars['custom']) ? $vars['custom'][$field->id] : null); I can confirm this has resolved my issue. Thanks for the great support guys!
Paul Posted August 21, 2013 Report Posted August 21, 2013 I have re-opened CORE-691 and noted this for Cody. I want to make sure this is in the patch tomorrow. Michael 1
Michael Posted August 21, 2013 Report Posted August 21, 2013 I have re-opened CORE-691 and noted this for Cody. I want to make sure this is in the patch tomorrow. Thanks mate, it's weird.
Michael Posted August 21, 2013 Report Posted August 21, 2013 I think Cody's fix from the other thread should be update /app/models/clients.php (line 89): $this->setCustomField($field->name, $client_id, isset($vars['custom']) && array_key_exists($field->name, $vars['custom']) ? $vars['custom'][$field->name] : null); to $this->setCustomField($field->id, $client_id, isset($vars['custom']) && array_key_exists($field->id, $vars['custom']) ? $vars['custom'][$field->id] : null); That fixed it thank you mate, Also this IP Address Regex I found that worked with my IP address: /^(??:1\d?\d|[1-9]?\d|2[0-4]\d|25[0-5])\.){3}(?:1\d?\d|[1-9]?\d|2[0-4]\d|25[0-5])$/
Recommended Posts