André P. Posted December 23, 2015 Report Posted December 23, 2015 Hi folks, First of all: Thanks for the great idea of a universal module. Everything works as intended. :-) 1. Pass id_value to API Is it possible to pass this value to the API? So far I work it around by using the Blesta API inside my API to get the value by client_id. That's an apiception I would like to avoid. 2. Check if field is domain I created a field "domain" inside my module. I see I can have it checked for "isEmpty" and "isUrl", but I need a way to check if it is a domain. I can write a function to check it, but I don't know where to place the check (I am not good at objective coding stuff, sadly). Another idea was to place some javascript at the bottom of the order template and check the field id against a regex. 3. Custom "return messages" Can I return an error message e.g. "domain is in use" when calling the API? 4. Add description for an input field And the last one: Is it possible to add a description for an input field without modifying the PHP file? If not, it's fine, I would just go and modify it then. :-) Cheers, André
Tyson Posted December 23, 2015 Report Posted December 23, 2015 On 12/23/2015 at 10:12 AM, André P. said: 1. Pass id_value to API Is it possible to pass this value to the API? So far I work it around by using the Blesta API inside my API to get the value by client_id. That's an apiception I would like to avoid. I assume you mean the `clients`.`id_value` field. This cannot be changed. It is set automatically based on your settings in Blesta with respect to other existing clients. On 12/23/2015 at 10:12 AM, André P. said: 2. Check if field is domain I created a field "domain" inside my module. I see I can have it checked for "isEmpty" and "isUrl", but I need a way to check if it is a domain. I can write a function to check it, but I don't know where to place the check (I am not good at objective coding stuff, sadly). Another idea was to place some javascript at the bottom of the order template and check the field id against a regex. There is no 'isDomain' validation rule, however, you can create your own using the 'matches' rule which validates according to your defined regular expression. You cannot write your own callback function to handle the validation from the UniversalModule (unless you actually update core code), so I don't think that would be the best route. Here's an example: {"service_label":{ "valid":{ "rule":["matches", "/^[0-9]{1}$/"], "message":"Label must be an integer" } }} On 12/23/2015 at 10:12 AM, André P. said: 3. Custom "return messages" Can I return an error message e.g. "domain is in use" when calling the API? What do you mean? The API does not accept error messages, however, it makes error messages available to you if there are any. You can do anything with them. On 12/23/2015 at 10:12 AM, André P. said: 4. Add description for an input field And the last one: Is it possible to add a description for an input field without modifying the PHP file? If not, it's fine, I would just go and modify it then. :-) Input field cannot set a description. How/where would such a description appear in the UI? Input fields could have tooltips associated with them, but the Universal Module does not currently support tooltips.
André P. Posted January 3, 2016 Author Report Posted January 3, 2016 Tyson said: I assume you mean the `clients`.`id_value` field. This cannot be changed. It is set automatically based on your settings in Blesta with respect to other existing clients.I don't want to change it, I want to pass it as value to my API. Like "https://something/api?action=add&id=clients_id_value. The universal module does post the client_id to the API but not the clients.id_value. So far I use the Blesta PHP API to get the clients.id_value by client_id. I just wonder if there is a better way to do this. Tyson said: There is no 'isDomain' validation rule, however, you can create your own using the 'matches' rule which validates according to your defined regular expression. You cannot write your own callback function to handle the validation from the UniversalModule (unless you actually update core code), so I don't think that would be the best route.Thanks! I use a RegEx now + check for availability with JQuery in a custom order form template. Tyson said: What do you mean? The API does not accept error messages, however, it makes error messages available to you if there are any. You can do anything with them.I was talking about msgs like "Cannot add XY: Item exists". But that's not a problem at all... Tyson said: Input field cannot set a description. How/where would such a description appear in the UI? Input fields could have tooltips associated with them, but the Universal Module does not currently support tooltips.I thought about a label or something, but it is not really necessary either.
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now