You need to sign in to do that
Don't have an account?
SaintMichael
Jquery checkbox value
Using JQuery to mobilize some pages in salesforce.
I am trying to use a checkbox, but I cannot get the checkbox value into my object.
Here is my code for the checkbox in the viauslforce page:
<div data-role="fieldcontain"> <fieldset data-role="controlgroup"> <input data-mini="true" type="checkbox" name="checked_out" id="checked_out" value="1"/> <label for="checked_out" data-inline="true">Checked Out:</label> </fieldset> </div>
Here is the javascript remoting part.
$(".insertButton").click(function() { alert($("#checked_out").val()); var merchRecord = { Operating_System__c: $("#operating_system").val(), Model__c: $("#model").val(), Asset_Tag__c:$("#asset_tag").val(), checked_out__c:$("#checked_out").val(), Hostname__c: "Hostname" }; $.mobile.showPageLoadingMsg(); InventoryExtension.insertInventoryItem(merchRecord, handleUpdate); });
In the above code, the alert proves to me that the value is a 1 or 0, when I set it so.
Using True, False, 0, 1 does not work.
Here is my error:
Insert failed. First exception on row 0; first error: INVALID_TYPE_ON_FIELD_IN_RECORD, Checked Out: value not of required type: 1: [checked_out__c]
Not sure why I cannot get a 0 or a 1 into the object.
Any ideas?
I made some progress.
I see if I hardcode the checkbox value, with no quotes, double or single, in the javascript like so:
This value gets into the object.
Just need to figure out how to get the value in with the poper format.
I worked it out:
Then pass 'isCheckedOut' to the Apex Controller: