Important Update: Some Community URL Redirects are Under Maintenance. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Code

AshaHB
Contributor III

Hi ,

 

I have a custom button created which is called Submit in questionnaire.So once they click submit, we should hide the submit button.

 

I have seen the code which is there in community to hide a button.

custom button:

<a title="Submit Certification" class="tb-btn-link-left" id="btnSetValue" href="javascript:void(0);" data-check-dirty="false"><div class="tb-btn" data-icon="" data-icon-pos="left">Submit Certification</div></a>

Save:

<a id="master_btnSave" class="tb-btn-link-left" href="javascript:void(0);" title="Save and Close" aria-disabled="false" role="button" data-check-dirty="true"><div class="tb-btn " data-icon-pos="left" data-icon="">Save and Close</div></a>

 

When I use the same code and try to make it hidden for Save works.

Can you please help me with solution

ASHA
4 REPLIES 4

DavidPetty
Archer Employee
Archer Employee

Asha, try

<a title="Submit Certification" class="tb-btn-link-left" id="btnSetValue" href="javascript:void(0);" onclick="$(this).hide();" data-check-dirty="false"><div class="tb-btn" data-icon="?" data-icon-pos="left">Submit Certification</div></a>‍‍

 Advisory Consultant

Hi David,

Thanks for response.

 

I have checked the code works when used separately.

 

I have to make that button hidden based on status when its complete.Status is a calculated field.

Below is the code I have been using can you help me where I'm going wrong.Because I don't see it working if I had with this code.

 

<script type="text/javascript">
Sys.Application.add_load(function() {
var valuesListFieldId = 60022 ; // This is the field id of the values list
var valuesListValueAId = 148586; // This is the id of the value to check against
var valuesListValue;

var RPFieldRoot = ArcherTech.UI.ClientContentManager.GetInstance().getFieldById(valuesListFieldId);
var RPFieldRootId = RPFieldRoot.clientId;
valuesListValue = $('input[id*="'+ RPFieldRootId +'"]').val();

if (valuesListValue = "Certification Complete")) {
<a title="Submit Certification" class="tb-btn-link-left" id="btnSetValue" href="javascript:void(0);" onclick="$(this).hide();" data-check-dirty="false"><div class="tb-btn" data-icon="?" data-icon-pos="left">Submit Certification</div></a>.insertAfter('#master_btnSave');
};
</script>

ASHA

first of all you need to get that a tag out of <srpript> tag as it is html, I hope your code is working till where ur comparing status if yes then try below, if it doesnt work try to debug the script in chrome developer tool to findout why its not working.

 

<script>

Sys.Application.add_load(function() {
var valuesListFieldId = 60022 ; // This is the field id of the values list
var valuesListValueAId = 148586; // This is the id of the value to check against
var valuesListValue;

var RPFieldRoot = ArcherTech.UI.ClientContentManager.GetInstance().getFieldById(valuesListFieldId);
var RPFieldRootId = RPFieldRoot.clientId;
valuesListValue = $('input[id*="'+ RPFieldRootId +'"]').val();

if (valuesListValue = "Certification Complete")) {

document.getElementById('btnSetValue').hide();

}

 

</scripts>

 

<a title="Submit Certification" class="tb-btn-link-left" id="btnSetValue" href="javascript:void(0);" data-check-dirty="false"><div class="tb-btn" data-icon="?" data-icon-pos="left">Submit Certification</div></a>.insertAfter('#master_btnSave');

Hi Team,

Can I use this custom code for submit button in Questionnaire?