Jump to content

Checkbox changes variable in results table


Recommended Posts

Hello,

 

In a result list of Action Items (todo) I want the user to just check a box and the items on the line of the checkbox changes its status to "In Approval".

I used this code in an HTML block (repeated every line), but doesn't seem to work.

 

<input id="doneCheck" type="checkbox" onclick="done();">

<script>
function done() {

if (document.getElementById('doneCheck').checked) 
  {
  document.getElementById("InsertRecordStatus").value="In Approval";

}

</script>

Any advise?

 

Thanks

 

Sergio

 

 

Link to comment
Share on other sites

Your ID "doneCheck" gets repeated every line so your script doesn't know which RecordStatus to update.

Add a parameter to your ID so the IDs are different every line, you'll also need to use an HTML Block so you can modify the ID

<input id="doneCheck[@RecordID]" type="checkbox" onclick="done();">

<script>
function done() {

if (document.getElementById('doneCheck[@RecordID]').checked) 
  {
  document.getElementById("customHtmlBlock[@RecordID]").value="In Approval";

}

</script>

 

All that being said, you might not be able to accomplish this unless each record is "editable". Typically reports display results that are not editable. Caspio does offer a "grid edit" option, but I haven't played with that much

 

Hope This helps

Link to comment
Share on other sites

Hi EIQ,

 

thanks for your answer. Indeed I forgot to consider that index must change. But is not clear to me what is the use of the HTML Block.

What I want to modify, in case the  checkbox is checked, is the field "Status". And unfortunately still cannot manage, maybe as you said caspio doesn't let me modify fields that are in the table results....

Link to comment
Share on other sites

As I understand you have a report page and you have bulk edit enabled. When user checks a box you want to change status, so what you can do is to change the form element of this field to checkbox in "  Configure Fields for Bulk Edit " and then for " Value when checked " have " In Approval ". There is no need for coding this way

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...