LemonStand Forum: form validation [required|optional] not used - LemonStand Forum

Jump to content

Severity 0 - None Assigned Status Unconfirmed
Version - Fixed in -

Page 1 of 1
  • Cannot start a new Issue
  • You cannot reply to this issue

Report ID #190: form validation [required|optional] not used

#1 User is offline  
EHLOVader 

  • LemonElite
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 309
  • Joined: 05-May 11

Posted 11 April 2012 - 08:15 AM

I am not sure if it is just me, or because it is happening when extending the product model but I am noticing that if validation is added to a field at all, it becomes required. Furthermore, calling optional on that field's validation does nothing to make it optional.

The following says that it is required.
$product->define_column('x_in_stock_date', 'In Stock Date')->validation();


As well as the following.
$product->define_column('x_in_stock_date', 'In Stock Date')->validation()->optional();


The only way around this is to not use any validation.
$product->define_column('x_in_stock_date', 'In Stock Date')



Page 1 of 1  
  • Cannot start a new Issue
  • You cannot reply to this issue

Replies (1 - 3)

#2 User is offline  
Manca 

  • Developer
  • Group: +Administrators
  • Posts: 252
  • Joined: 02-September 11

Posted 11 April 2012 - 11:34 AM

Updating status to: Unconfirmed

Hi Joe,

I tested your example and had no issues saving the product with the custom field left empty. What kind of validation are you using? Can you share the module code? Feel free to send it in a ticket.

Thank you

#3 User is offline  
EHLOVader 

  • LemonElite
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 309
  • Joined: 05-May 11

Posted 11 April 2012 - 01:26 PM

Manca, on 11 April 2012 - 03:34 PM, said:

Updating status to: Unconfirmed

Hi Joe,

I tested your example and had no issues saving the product with the custom field left empty. What kind of validation are you using? Can you share the module code? Feel free to send it in a ticket.

Thank you


I think it may have been dates.

I went back and looked over it, and it wasn't a required field, but rather that the date wasn't the right format. I had assumed that it would remain optional if I did nothing, and I even tried to explicitly set it to optional. Is there a way to make date, time and any others which may have a specific format to match not cause a fail if blank is matched?

#4 User is offline  
activeholdingco 

  • LemonGroupy
  • PipPipPipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 187
  • Joined: 23-September 10

Posted 19 April 2012 - 07:06 PM

Right now you can't add any validation to a datetime field which should be a bug.

Easy way to test should be, add a new datetime field:
$product->define_column('x_in_stock_date', 'In Stock Date')->validation();


You should see a bunch of errors when trying to edit the value.

It ties in with this other bug:
http://forum.lemonst...eld-not-saving/


Page 1 of 1
  • Cannot start a new Issue
  • You cannot reply to this issue

0 User(s) are reading this issue
0 Guests and 0 Anonymous Users