Please read and follow the COMMON ISSUES first!
Always add your version information in every new post! Thank you!

Form2Content Forum

Questions and answers for Form2Content, a Joomla CCK.
  1. FMP Manager
  2. F2C Content type settings
  3. Sunday, January 17 2016, 07:38 AM
  4.  Subscribe via email
Apologies in advance if this is addressed elsewhere. I searched extensively but couldn't find an answer.

To be brief, I have created a text field for URL input. The field is NOT required, but I entered validation strings for both javascript and php just in case I decide to make it required in the future. Logically, validation should only kick in if a field is not empty. However, in the front end, even if the field is empty, I will still get an error message that the field is invalid.

Is this intentional? Is there a workaround? I'd hate to remove my validation definitions if at all possible (but I could if I had to). Thanks in advance for the help. :)
Accepted Answer
Julien Accepted Answer
Hi,

I have a feeling that it is working correctly, just not what you might expect...;) Let me explain it:

The required setting only checks whether a field value has been provided or not.
Next to that you can set a regular expression for the field, which works independant from the required setting.

When a field is not required it will be validated by the regular expression, but then you have to accept an empty string as valid input as well. This means that you have to alter the regular expression so that it accepts an empty string as well.

best,
Julien
Responses (3)
F2C webmaster Accepted Answer
Hi,

This is a more advanced situation in which I think the current working is as described. But to check can you send the actual code you are using to validate and your Joomla/F2C version info?

Thanks,
Patrick
Please read the F2C documentation before asking questions! Thank you if you've done so ;)
  1. more than a month ago
  2. F2C Content type settings
  3. # 1
FMP Manager Accepted Answer
Sorry! I guess that's what I get for posting when I only have one bloodshot eye open. :)

F2C Pro Version: 6.13.0
Joomla Version: 3.4.8

To summarize (coherently this time, I hope), I have an HTML5 text input field with selected type URL. The field is not required. I entered validation rules for this field. The only time validation should occur is if the field is being populated. A blank field that is not required should not trigger validation.

Or, is this an incorrect interpretation of how this works in F2C?

For now, I've just removed the validation strings I'd entered and everything seems to work fine now.
  1. more than a month ago
  2. F2C Content type settings
  3. # 2
F2C webmaster Accepted Answer
Better late than never ;)

I will ask Julien to check the working, your explanation is very clear :)

Regards,
Patrick
Please read the F2C documentation before asking questions! Thank you if you've done so ;)
  1. more than a month ago
  2. F2C Content type settings
  3. # 3
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.