Function is not defined
Posted by schuess - Jun 11 ’14 at 03:29
I have the following function in my javascript
function myFunc(){
var myURL = fd.field('urlOfMeetMin').value();
//alert(myURL)
window.location.href= myURL;
}
I added a button to the form, and in the Onclick config box i put
myFunc();
Error: myFunc is not defined
-
Dmitry KozlovAdminMember for: 8 years 9 months 7 days
Hello,
Please, define your function globally:
window.myFunc = function(){ var myURL = fd.field('urlOfMeetMin').value(); //alert(myURL) window.location.href= myURL; }
Now, you can use it in OnClick handler.
-
schuessMemberMember for: 8 years 5 months 5 days
Thank you, that worked.
I just can not seem to grab the value of the field: fd.field('urlOfMeetMin').value(); Keeps returning undefined.
//window.myFunc = function(){
//var myURL = fd.field('urlOfMeetMin').value();
//alert(myURL)
//window.location.href= myURL;
//}//window.myFunc = function(){
//window.location.href =fd.field('urlOfMeetMin').value();
//} -
schuessMemberMember for: 8 years 5 months 5 days
UPDATE
i got it to work, but it was the documentation that was throwing me off
On site: http://formsdesigner.blogspot.com/2013/04/getting-and-setting-sharepoint-form.html
It says use this to get a fields value: fd.field('Title').value();
But really this is what works. fd.field('Title').control()._el().text();
-
eedohMemberMember for: 8 years 4 months 28 days
if that's a textbox control, you're missing .control(), before .value(). Take a look at the following link
http://formsdesigner.blogspot.com/2013/04/getting-and-setting-sharepoint-form.html