Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I want to use a PeoplePicker or a PeopleEditor on Mobile Devices(via browser, under SharePoint Mobile View) just like on a desktop browser.

Firstly, I tried to add the PeopleEditor control in code behind through C# code, in the .aspx file. The aspx file references sp.js, sp.runtime.js, sp.core.js, MicrosoftAjax.js that are also imported, but I still get a lot of JS error.

Secondly, I tried to customize my own PeoplePicker via Client Object Model, but I am still stuck on the same JS error.

Please tell me how to approach the goal any suggestion will be appreciated.


I reference the JS file by js code dynamically as below:

function loadScript(src, script, callback) {

    script = document.createElement('script');
    script.onerror = function () {
        // handling error when loading script
        alert('Error to handle:' + src);
    }
    script.onload = function () {
        console.log(src + ' loaded ')
        callback();
    }
    script.type = "text/javascript";
    script.src = src;
    document.getElementsByTagName('head')[0].appendChild(script);
}

And in the .cs file, I wrote my own control which inherit from System.Web.UI.MobileControls.MobileControl, and then in the CreateChildControls() function, I add the PeopleEditor dynamically:

protected override void CreateChildControls()
    {
        PeopleEditor peoplePick = new PeopleEditor();
        peoplePick.AllowEmpty = false;
        peoplePick.AllowTypeIn = true;
        peoplePick.ErrorMessage = "No Names Found";
        this.Controls.Add(peoplePick);
        base.CreateChildControls();
    }

Finally, I registered this control in .aspx file and added an instance:

<MyCustomeMobile:CustomeControl RunAt="Server" />

Then,I got those JS error:

  1. Uncaught TypeError: Cannot call method 'createRange' of undefined [from entityeditor:2]
  2. Uncaught RangeError: Maximum call stack size exceeded Uncaught ReferenceError:
  3. Uncaught ReferenceError: WebForm_DoCallback is not defined

Maybe there is another way to resolve this problem,what just i want is user can search people/group by typing userId in a textbox and then show user's name(just like on laptop browser).

share|improve this question
1  
Hi and welcome to SP.SE Jason. You have a good question, but to be able to answer it we need a little more detail. Could you supply the error message from JavaScript Console, and also the failing source code. With that information added to the question, I'm confident that you will get guidance. Nice to see you on our site! –  Benny Skogberg Nov 2 '13 at 8:14
1  
Hi Benny,I'm a newer here.Thanking for your advice in advanced.I have added some detail information.if not enough,i will paste all of the code.Thanks agian! –  Jason Chan Nov 2 '13 at 14:43
    
@BennySkogberg Could you please give me some adivce? –  Jason Chan Nov 3 '13 at 6:28
1  
I'm Sorry, but I don't know how to solve your problem. I still hope for somebody else to answer the question you have. If not today, probably on Monday. –  Benny Skogberg Nov 3 '13 at 7:58

1 Answer 1

up vote 0 down vote accepted

You have to create some custom control or Custom code for that.

I will suggest you can use CSOM for get users. Below is the example might be use full to you

http://msdn.microsoft.com/en-us/library/jj713593.aspx

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.