validation dose not work
-
tried to apply the validation to text and textarea elements but there is no validation, blank form is submitted
-
The way I did validation is that it will allow blank answers, so that you could validate an optional field. If you make the elements required that should solve your problem.
thanks for your quick answer. Actually I did check the required option but it does not work.
below is my genereted codefm_current_form = 1;fm_register_form_item('1', {"ID":"1","index":"0","unique_name":"text-4df0a4e6ee564","type":"text","extra":{"value":"","size":"300","validation":"validator-4","maxlength":""},"nickname":"","label":"\u30d5\u30ea\u30ac\u30ca","required":"1","db_type":"DATA","description":"Item Description","required_callback":"fm_base_required_validator","required_msg":"'\u30d5\u30ea\u30ac\u30ca' is required.","validation_callback":"fm_text_validation","validation_msg":"'\u30d5\u30ea\u30ac\u30ca' must not be null or contain all space characters","validation_type":"validator-4","getter_script":"fm_base_get_value"}); fm_register_form_item('1', {"ID":"1","index":"1","unique_name":"text-4df0a4cb1f84d","type":"text","extra":{"value":"","size":"300","validation":"none","maxlength":""},"nickname":"","label":"\u6c0f\u540d","required":"1","db_type":"DATA","description":"Item Description","required_callback":"fm_base_required_validator","required_msg":"'\u6c0f\u540d' is required.","validation_callback":"fm_text_validation","validation_msg":"","validation_type":"none","getter_script":"fm_base_get_value"}); fm_register_form_item('1', {"ID":"1","index":"2","unique_name":"text-4df572832b1a2","type":"text","extra":{"value":"","size":"300","validation":"none","maxlength":""},"nickname":"","label":"\u4f4f\u6240","required":"1","db_type":"DATA","description":"Item Description","required_callback":"fm_base_required_validator","required_msg":"'\u4f4f\u6240' is required.","validation_callback":"fm_text_validation","validation_msg":"","validation_type":"none","getter_script":"fm_base_get_value"}); fm_register_form_item('1', {"ID":"1","index":"3","unique_name":"text-4df575fd97da5","type":"text","extra":{"value":"","size":"300","validation":"phone","maxlength":""},"nickname":"","label":"\u96fb\u8a71\u756a\u53f7","required":"1","db_type":"DATA","description":"Item Description","required_callback":"fm_base_required_validator","required_msg":"'\u96fb\u8a71\u756a\u53f7' is required.","validation_callback":"fm_text_validation","validation_msg":"'\u96fb\u8a71\u756a\u53f7' must be a valid phone number","validation_type":"phone","getter_script":"fm_base_get_value"}); fm_register_form_item('1', {"ID":"1","index":"4","unique_name":"text-4df5761e66376","type":"text","extra":{"value":"","size":"300","validation":"email","maxlength":""},"nickname":"","label":"\u30e1\u30fc\u30eb","required":"1","db_type":"DATA","description":"Item Description","required_callback":"fm_base_required_validator","required_msg":"'\u30e1\u30fc\u30eb' is required.","validation_callback":"fm_text_validation","validation_msg":"'\u30e1\u30fc\u30eb' must be a valid E-Mail address","validation_type":"email","getter_script":"fm_base_get_value"}); fm_register_form_item('1', {"ID":"1","index":"5","unique_name":"textarea-4df5763e3006c","type":"textarea","extra":{"value":"","rows":"300","cols":"500"},"nickname":"","label":"\u304a\u554f\u5408\u305b\u5185\u5bb9","required":"1","db_type":"DATA","description":"Item Description","required_callback":"fm_base_required_validator","required_msg":"'\u304a\u554f\u5408\u305b\u5185\u5bb9' is required.","validation_callback":"","validation_msg":"","validation_type":null,"getter_script":"fm_base_get_value"});
Do you have a link to the form that is broken?
here is the link of the form that is broken
https://le-bouquet.sakura.ne.jp/reservethank you very much
No problem, I’m glad to help. I looked at the code on your site and it looks like the scripts for the plugin are not being loaded. There should be two ‘script’ tags in the head of the document that load ‘userscripts.js’ and ‘l10n.js’. Without these scripts the form will submit without checking validation or required items like is happening for you. I’m not sure why these scripts aren’t being loaded, though. Possibly there is no wp_head() in your theme’s header, or another plugin is removing the scripts. I hope that helps.
thanks it works^^
I am using the /[^ぁ-んァ-ン\s]+/ in order to check japanese characters for the same site which I mentioned above
it is working with normal javascript but failed for the form manager
do you have any suggestionOkay – please forgive me for using the form, I posted some junk data. One problem I noticed is one of the other validators you added needs to have a forward slash (/) at the beginning and end, so it will be:
/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/
Even though this validator is not used it will still crash the script without the slashes, so this might be the problem. Also, it looks like you want to prevent ぁ-ん, ァ-ン, and whitespace for the element ‘フリガナ’, correct?
thanks for your help
in case I would like to get the parameter value from the URL such as https://le-bouquet.sakura.ne.jp/reserve?partyId=1
do you have any suggestion what should I do
$_REQUEST[‘partyId’]
Check out https://www.php.net and https://www.php.gr.jp/
thanks for the help
however what I would like to do is that I want to get the parameter value from the URL and display it in the form which is generated by Form Manager
do you have any suggestion?
I see what you mean now. Unfortunately there isn’t really a good way to do that through normal use of the plugin.
For now though you could put some code in your theme for that particular page. The $fmdb class gives you information about the form items, if you know the form slug and item nickname:
global $fmdb;
$nickname = (item nickname);
$slug = (form slug);
$formID = $fmdb->getFormID($slug);
$item = $fmdb->getItemByNickname($formID, $nickname);Then $item[‘unique_name’] holds the id attribute of the input/select/textarea tag, so you could then echo some javascript setting the element’s value. There should be an easier way to do this, I’ll add something like that for the next update. Good luck.
thanks alot for your help
I would like to ask you where is the posted data taken place in your plug in cause I would like to update also other information in the database after submit the data
thank you very much
If you go to the ‘submission data’ tab when you are editing a form you will see it.
- The topic ‘validation dose not work’ is closed to new replies.