Thanks for the message, but let's not ask questions privately.... the point of a forum is for people to find that somebody else has already asked the same question.
Quote
Hi, Hope you are fine,
May you please help me out. I am having a serious problem with what I want to achieve here. I want to update a database field namedstatusand change it's value toapprovedwhen a checkbox is checked or leave it as pending when the checkbox is not checked. here is my code:
<SCRIPT LANGUAGE="JavaScript">
function Updatestatus()
{
if (document.getElementById("approved").checked==true)
{
document.getElementById("status")="approved";
}
else if (document.getElementById("approved").checked==false)
{
document.getElementById("status")="pending";
}
document.getElementById("caspioform").onsubmit= Updatestatus;
</SCRIPT>
its not doing anything i don't know where I am wrong. please assist
A couple things to note
1 - I've had trouble using JS and Caspio's checkboxes. Dropdowns are easier to work with.
2 - I never use 'onsubmit'. Rather i create a fake submit button that runs that code I need before the submit happens then wrap the function with: document.getElementById("Submit").click()
** If you must have something easier than a dropdown...
This takes some work, but will allow you to do it.
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.
Question
LWSChad
Hi @abelphathost,
Thanks for the message, but let's not ask questions privately.... the point of a forum is for people to find that somebody else has already asked the same question.
A couple things to note
1 - I've had trouble using JS and Caspio's checkboxes. Dropdowns are easier to work with.
2 - I never use 'onsubmit'. Rather i create a fake submit button that runs that code I need before the submit happens then wrap the function with: document.getElementById("Submit").click()
** If you must have something easier than a dropdown...
This takes some work, but will allow you to do it.
HTML block
<style>
#YOUR_FIELD_ID {display: none}
.fake-radio {
width: 120px;
height: 50px;
padding: 16px;
margin: 16px 0 0 32px;
font-size: 18px;
float: left;
}
</style>
<div class="fake-radio" onclick="document.getElementsByName('YOUR_FIELD_ID')[0].value = 'Yes';>Yes</div>
<div class="fake-radio" onclick="document.getElementsByName('InsertRecordFieldName')[0].value = 'No';>No</div>
YOUR_FIELD_ID
1. right click the field you want to populate > inspect
2. Look for <xx class="sample" id="XYZ_98sd7d" name="InsertRecordYOURFIELDNAME">Hi World</xx>
3. your answer is InsertRecordYOURFIELDNAME
Try these suggestions and I'm sure you'll find your solution
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
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.