Forum Replies Created
-
AuthorPosts
-
Hi Alex,
I have a form , on click of a button it calls an API.
The response value from API needs to be set into a hidden field on the form which needs to be saved to my custom list data. I am calling the save after calling the API.Attached is the customJS file. I need help in reading the return value from API call and saving it to the list.
Can you help?
Thanks,
VidyaAttachments:
Hi Alex,
How can I debug the Custom JS? I am not able to find the script in the Chrome debugger.
Thanks,
VidyaHi Alex,
We are calling a custom Workflow on click of buttons on the form, i have 5 buttons amogng two tabs. When a button is clicked a dropdown value of status need to be updated and an API needs to be called.
How can I set a field which is of type Choice – Drop Down, Can you please help me with the syntax. I saw syntax for Radio Button but couldnt find for DropDown in the manual.
ALso any tips on debugging the custom JS in Chrome? Had a hard time finidng control/scripts on the newform.aspx page. Had to use alerts to debug.
Thanks,
VidyaHi Alex,
Below is my custom code, I have a HTML button called Save as draft and on click of it i am calling an API which, after the API call is done the page is submitting itself and refreshing. How can i stop the page from doing it? I am not even using the default save button.
$(“input[id$=’diidIOSaveItem’]”).hide();
$(“input[id$=’diidIOGoBack’]”).hide();$(“button[id$=’btnSave’]”).click(function(){
alert(“Save Draft Button clicked”);
});function SaveAsDraftButtonClicked()
{var auth = btoa(‘username:pwd’);
alert(” Inside Button Click”+auth);
$.ajax({
type: ‘GET’,
url: ‘SomeURL’,
headers: {
“Authorization”: “Basic ” + auth
},success : function(data) {
console.log(data);alert(data.id);
},
});
alert(“After calling the API”);return false;
}Hi Alex,
Here is my code to call an API, I get a valid response from the browser but this call from Custom JS is not working. I am not sure what is wrong. send () is the function called on clicking a HTML button, The required fields should be validated , a field shud be set and an API call should be made.
function send()
{
alert(‘Inside Send function’)var urlvariable;
urlvariable = “URL goes here”;
var ItemJSON;
URL = urlvariable;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = callbackFunction(xmlhttp);
xmlhttp.open(“POST”, URL, false);
xmlhttp.setRequestHeader(“Content-Type”, “application/json”);
xmlhttp.setRequestHeader(‘Authorization’, ‘Basic ‘ + window.btoa(‘username:pwd’)); //in prod, you should encrypt user name and password and provide encrypted keys here instead
xmlhttp.onreadystatechange = callbackFunction(xmlhttp);xmlhttp.send();
alert( “Response Text : ” + xmlhttp.responseText);
// document.getElementById(“div”).innerHTML = xmlhttp.statusText + “:” + xmlhttp.status + “<BR><textarea rows=’100′ cols=’100′>” + xmlhttp.responseText + “</textarea>”;
}function callbackFunction(xmlhttp)
{
alert(“Response Text : ” + xmlhttp.responseXML);
$(“input[id$=’SaveItem’]:first”).trigger(“click”);
}Hi ALex,
I need your help in finding out how to update fields in custom JS.
I have a form with two buttons, “Save as draft” and “Submit”, I have added them as HTML buttons on form and have hidden the defaut save and cancel button.
I have a multichoice field called Status in my custom list. This value gets updated on click of buttons on my form.
When Save as draft button is clicked, I should have my Multi choice field ” Status” to be set as “Pending Submission”
This is my button html and custom JS
<button onclick=” SaveAsDraftButtonClicked()”>Save as Draft</button>
function SaveAsDraftButtonClicked()
{alert(‘Save as Draft Button is CLicked’);
}I also need to call a JBPM workflow API passing crendiatls after button click.
Can you please help me with the custom code for it.Thank you!
Yes i was….sigh…thank you!
Hi Alexander,
I tried the above customJS and getting this error, please see attched.
Thanks,
VidyaAttachments:
Thank you, i was able to get them working.
yes i did, i tried and it didn’t work. Here is what i have done. I cannot show the real lists due to confidentiality.
My Base List Column
EMployeeName, EMployeeAddress, EmployeeState, EmployeeCityMy lookup list is similar to a State , city list. So i have list columns named State and City, with Values NJ, PA and MA and a City column with Values Trenton, Newark, Jersey City, Philadelphia, Boston etc
State City
NJ Trenton
NJ Trenton
PA Philadelphia
MA BostonComma separated list of fields in the lookup list
InternalNameforState, InternalNameForCityComma separated list of fields in the current list
InternalNameforEmployeeState,InternalNameforEmployeeCity -
AuthorPosts