Jump to content
DataAdmin

TimeStamp When Checkbox is ticked

Recommended Posts

Hi

I've tried using this on my footer but it does not work.

 

 

My datapage is a results page with inline edit set to yes.

Below is my script:

<SCRIPT LANGUAGE="JavaScript">
function setTime(){

var v_chk=document.getElementById('EditRecordConfirmed').checked;
if(v_chk==true)
{
document.getElementById("EditRecordDateConfirmed").value="[@cbTimestamp]";
}

}
document.getElementById("caspioform").onsubmit=setTime;
</SCRIPT>

Thanks.

Ivy

Share this post


Link to post
Share on other sites
On 2/14/2017 at 4:52 PM, DataAdmin said:

Hi

I've tried using this on my footer but it does not work.

 

 

My datapage is a results page with inline edit set to yes.

Below is my script:

<SCRIPT LANGUAGE="JavaScript">
function setTime(){

var v_chk=document.getElementById('EditRecordConfirmed').checked;
if(v_chk==true)
{
document.getElementById("EditRecordDateConfirmed").value="[@cbTimestamp]";
}

}
document.getElementById("caspioform").onsubmit=setTime;
</SCRIPT>

Thanks.

Ivy

Hi Ivy,

As far as I know, we can't use java script in Inline edit mode. That's why I would recommend editing record on details page.

That script should work on details page

Share this post


Link to post
Share on other sites
On 2/17/2017 at 10:25 PM, Mathilda said:

Hi Ivy,

As far as I know, we can't use java script in Inline edit mode. That's why I would recommend editing record on details page.

That script should work on details page

Hi Mathilda,

Thanks a lot for the reply.

I tried testing all the possible scripts discussed in forum and it all did not work.

And now I know the reason why.

Your response is what I badly needed.

Thanks heaps.

Ivy

 

Share this post


Link to post
Share on other sites
On 2/19/2017 at 4:39 PM, DataAdmin said:

Hi Mathilda,

Thanks a lot for the reply.

I tried testing all the possible scripts discussed in forum and it all did not work.

And now I know the reason why.

Your response is what I badly needed.

Thanks heaps.

Ivy

 

Hi Ivy,

I have good news for you :)

I was able to make it to work with jquery. Wrap your fields in div with ID cbform-improvement. Also you need to disable ajax on your report and paste the following script in the footer:

<script>
$("#cbform-improvement #Mod0InlineEdit").click(function(e){
var chkbx_before = "[@field:Field_name^]";
var chkbx_now = $("[name=InlineEditField_name]").is(':checked');

if(chkbx_before!="Yes"){
 if(chkbx_now){
  var timestamp = '[@cbTimestamp]';
  $("[name=InlineEditField_for_date]").val(timestamp);
 }
 else {
  var timestamp = '';
  $("[name=InlineEditField_for_date]").val(timestamp);
 }
}

});

</script>

Don't forget to paste your field names.

Share this post


Link to post
Share on other sites

Mathilda

 

I am also keen to use some JS to concatenate two fields within an inline edit.

Tried using your script with some changes and not able to get it to work.  Could not even get an alert to fire so something is way wrong.  Was wondering re the div wrapping.  Am I able to put those in the Header and Footer?

Any help you can give would be v gratwefully appreciated.

 

George

 

My alert testing script was:

<script>
$("#cbform-improvement #Mod0InlineEdit").click(function(e){
alert ('hello');
}
)
</script>

-------------------------------

 

The actual script I would like to use is:

Where "TP_Applications_Outcome" is the result of a cascading dropdown.  "TP_Applications_Internal_Notes" is a text Area field holding just text for di0laying in html i.e. with tags on details screens.

<script>
$("#cbform-improvement #Mod0InlineEdit").click(function(e){


var outcome = $("[name=InlineEditTP_Applications_Outcome]").value;
var notes1 =  "[@field:TP_Applications_Internal_Notes]";
var auth= "[@authfield:Username]";

var notes2 = "(" + auth + ")" + " Stage Changed to: <b>" + outcome + "</b><br><br>" + notes1;
$("[@field:TP_Applications_Internal_Notes]").val(notes2);
}
)
</script>

 

Share this post


Link to post
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...