开发者

How do I set a SharePoint list field in NewForm.aspx based on an input radio button?

I have modified the NewForm.aspx page for a SharePoint list, and am changing the visibility of cer开发者_如何转开发tain div's based on the value of radio input buttons. I'd like these values to be passed to a list field as well. I have a couple of questions regarding this:

1) How can I pass the Yes/No value from the radio input to a SharePoint list field? 2) Can I drop a Yes/No field from the list on the form and use that to control the visibility of my div's?

Thanks.


Since you're already using JavaScript, on your NewForm.aspx you could probably use SPUtility.js; full disclosure, this is an open source library I maintain.

Both of the options you mention are possible. I haven't added support for Yes/No fields (as of v0.3) but you could probably do something like this.

  1. Create a single line of text field (will hold your value in the list). Lets call it "Text Field".
  2. Based on our radio button input, call SPUtility to set the field's value: SPUtility.GetSPField('Text Field').SetValue('Hello world!');

You could also probably hide "Text Field" so they can't see the value change.

Or... if you wanted to go with option #2, you could help me add support for Yes/No fields. :)

Hopefully this helps.


You can use our Smart List Pro product to modify your list form. We have various capabilities, such as showing/hiding fields depending on values of other fields and user identity, tabbed interface and much much more.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜