Jump to content

Recommended Posts

Posted

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?

Posted

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.
Posted

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.

Posted
  On 8/21/2013 at 12:31 AM, CraigA said:

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.

Posted

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

Posted
  On 8/21/2013 at 12:40 AM, CraigA said:

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.

Posted
  On 8/21/2013 at 12:40 AM, CraigA said:

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

Posted
  On 8/21/2013 at 1:08 AM, CraigA said:

Yes, mine is the first (and only) one on the form.

Bet that's the issue haha :D just need Paul, Cody or Tyson to confirm this and hope they issue a fix lol.

Posted

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.

Posted
  On 8/21/2013 at 1:10 AM, Tyson said:

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. 

Posted
  On 8/21/2013 at 1:10 AM, Tyson said:

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.

Posted
  On 8/21/2013 at 1:16 AM, CubicWebs said:

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 :)

Posted

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 :'(

Posted

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);
Posted
  On 8/21/2013 at 3:50 AM, Tyson said:

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!

Posted
  On 8/21/2013 at 6:39 AM, Paul said:

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.

Posted
  On 8/21/2013 at 3:50 AM, Tyson said:

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])$/
Guest
This topic is now closed to further replies.
×
×
  • Create New...