itsberni 7 Posted October 15 Hi Guys, i use the embed-method "D" in Formbuilder. In the form i use some checkboxes for calculating. To achieve this i set the value of the checkbox like this: <input name="myCheckbox" type="checkbox" value="<?= $someValue ?>" /> When i send the Form, the value changes into the entry, i made in formbuilder in the Detail-Section of the checkbox-field. does anybody know, how to accomplish, that the Form sends my specific value? many thanks! Quote Share this post Link to post Share on other sites
dragan 1,486 Posted October 15 I'm confused. Are you using checkboxes or radio buttons? Unless you don't check the relevant radio button, you won't get any value after submitting the form. Or maybe I don't understand what you're really asking? Quote Share this post Link to post Share on other sites
itsberni 7 Posted October 15 4 minutes ago, dragan said: I'm confused. Are you using checkboxes or radio buttons? Unless you don't check the relevant radio button, you won't get any value after submitting the form. Or maybe I don't understand what you're really asking? Sry for confusion.... corrected the Post. Quote Share this post Link to post Share on other sites
itsberni 7 Posted October 16 something for further explanation: I want to calculate a price using checkboxes: e.g. checked state <input name="myCheckbox" type="checkbox" value="15" /> unchecked <input name="myCheckbox" type="checkbox" value="0" /> the change of the value happens via js. now, in case of submission, the value in the Database is that one ( Detail - Tab of the FB-Field ) These entrys appear as well in a page ( i create a page with this data ) as in the admin-Email. it seems to be, that FB ignores my specific value in case of submission. i also tried to let this fields empty to force the use of my values but the first one is mandatory. that works neither. Some ideas.....? Quote Share this post Link to post Share on other sites
OLSA 189 Posted October 18 I don't use Form builder, and maybe I don't understand your problem, but - in case of unchecked field - on server side you will not have any value ( just like that field doesn't exist). On 10/15/2019 at 2:07 PM, itsberni said: When i send the Form, the value changes into the entry On 10/16/2019 at 6:04 AM, itsberni said: the change of the value happens via js. I understand this like that you - on submit event - change/set checkbox value? If this is the case, do you 1) prevent default submission event, 2) change checkbox value, and after that, 3) proceed submission? Something like this: // basic example $("form").on("submit", function(e) { // stop submission e.preventDefault(); // set checkbox value // ... // proceed submission $(this).submit(); // or return true or... }); But if not, than form will not send checkbox value because it's happens later (after submit). If all this is not a problem, maybe you can try to use different approach? As example, use hidden field - and - use checkbox change event to set it's value. Or, another could be to use select field and maybe you can think about that option? Regards. Quote Share this post Link to post Share on other sites
itsberni 7 Posted October 21 Thanks for sharing your thoughts. i'll try to solve it with a hidden field for each checkbox. Quote Share this post Link to post Share on other sites
rick 512 Posted October 21 @itsberni, I'm not sure I understand your specific use case completely. When you say "Form sends my specific value", there are only two values for a checkbox when submitted: It's either present or not. For example: if( isNull($input->post('YourCheckboxFieldNameHere')) ) { // User did not check checkbox, so set a default or whatever. } If your specific value (used in your computations) is numeric, ie, a dollar amount, or temperature, or distance measurement, etc., then you will need to use an input type that accepts numeric entries. The checkbox is not the correct input type for your data. I don't use form builder so I can't provided specific instructions. In HTML it would be the input type text. Can you be more elaborate with what you are trying to accomplish? I'm sure someone here will have the answer you seek. Quote Share this post Link to post Share on other sites
itsberni 7 Posted October 22 Hi Rick, this was my misunderstanding. I had the opinion that i could set a specific value to a checkbox. my usecase is a form, where you can choose ( via checkbox ) different "products". Every product has, of course, it‘s own price. When Checkbox is Chosen and the form is sent the value of the checkbox should be submitted - that was my thought - misbelief 😉 thank you though.... Quote Share this post Link to post Share on other sites
rick 512 Posted October 22 If you allow the user to select one or more products, you can use a select field to present the options to the user. Of course it depends on the number of available products. If there are a large number of products, you may want to separate them by category. The select field's options allow for values that you require. 1 Quote Share this post Link to post Share on other sites