-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Checkbox value #1
Comments
Hi @uovidiu, I'm glad someone can get benefit from my enhanced code, and hopes you use the dev branch of my code which I'm working on it. As your problem, I noticed that you add "values" in the schema? what's that for? why not put the values you want as the enum values? for all radios/checkboxes/radiobuttons/checkboxbuttons type form elements, we can have 2 values for each option, one is title, which is for display, the other is value, which is the value in the json we got in onSubmit. so, if you want "starter-val" in result json, then you just need put it in the enum of schema, and also use "starter-val" as the key of the titleMap of the form element definition. do I get the point? |
I wasn't aware of that option, to set a value. I've checked the documentation and your examples from playground but no luck. Can you give me an example on how to use values for checkboxes in a schema please? Maybe use the one I've used in my issue. Thanks for your quick response. |
Sorry, I still can not get what you want, you need explain more detail then I can help. the playground now is same code with my dev branch. The playground examples show more on how to use it in some way, specially for some enhanced feature. |
You said "for all radios/checkboxes/radiobuttons/checkboxbuttons type form elements, we can have 2 values for each option, one is title, which is for display, the other is value, which is the value in the json we got in onSubmit." |
OK, so I got some point. so you are not use the result json in onSubmit, to archive that, you need remove the enum in the schema, and use "options" 2014-11-19 20:39 GMT+08:00 Ovidiu Ungureanu notifications@github.com:
Ulion |
I'm using this var form = $('#preview');
form.on('submit', function (ev) {
ev.preventDefault();
$.ajax({
type: "POST",
url: "<?php echo SITE_MODULES;?>/forms/ajax_call.php",
cache: false,
data: {
fields: $(this).serialize(),
'form_id': '<?=$entry['id'];?>',
'no_action': 'form_submit'
},
dataType: 'json',
success: function(data){
// alert(data);
}
}); From your example I see that I can set values based on the array, I will change that in my schema and test. |
Oh, you used $(this).serialize(). that's the reason. |
Hi,
I'm using your script to render a dynamic form and store the data into database.
The problem I have is with multiple choices, radio buttons.
Do you think it make sense to add an option for checkbox values?
Using your example, something like this
Currently I did a small change in your script, replacing this
with this
The text was updated successfully, but these errors were encountered: