none
custom list form using client side validation RRS feed

  • Question

  • i have below details in the custom list new form

    user description:(choice field)

    user full name:(single line)

    user address:(single line text)



    • Edited by sree_23 Monday, July 29, 2019 9:18 AM
    Wednesday, May 22, 2019 6:30 AM

Answers

  • Hi

    Will datasheet view help you?

    Seeing your above description its looks like you want all fields to displayed in a single row.

    Thanks


    • Marked as answer by sree_23 Monday, July 29, 2019 9:18 AM
    Thursday, May 23, 2019 11:08 AM

All replies

  • Wednesday, May 22, 2019 7:04 AM
  • Hi

    Here is Code for repeating fields using Jquey & CSOM. Hope this helps.

    <script src="/Shared%20Documents/jquery.min.js" type="text/javascript"></script>
    <script src="/Shared%20Documents/jquery.SPServices-0.7.1a.min.js" type="text/javascript"></script>
    
    <script type="text/javascript">
        	var array = [];
    		$(document).ready(function() {
    			
    			var click = 1;
    			$("#btn_id_1").click(function() {
    				click ++;
    				$("#tr_id_1").clone().appendTo("#tbl_id_1").attr("id", "tr_id_" + click.toString()).find("input").val("");
    				});
    			$("#btn_id_2").click(function() {
    				//Save();
    				//Call();
    				var asyncPromises = Save();
    
    				asyncPromises.done(function(result) { 
    					//alert(array.length);
    					console.log(array.length);
    					for (var i=0; i<array.length; i++) {
    						//alert(array[i].get_id());
    						console.log(array[i].get_id());
    						}
    					});
    
    				asyncPromises.fail(function(result) { 
    
    					});
    				
    				
    
    				});
    			});
    
    		function Save() {
    
    			var buildDeferredSaves = $.Deferred(function() {
    
    				//var array = [];
    				var ctx = new SP.ClientContext.get_current();
    				var taskList = ctx.get_web().get_lists().getByTitle('YourListName');
    				var taskItemInfo;
    				var userdesc;
    				var userfullname;
    				var UserAdd;
    				
    				$("#tbl_id_1 tr").each(function() {
    					
    
    					userdesc =$('#myselect').find('option:selected').text();
    					userfullname = ($(this).find(".userfullname")).val();
    					UserAdd = ($(this).find(".UserAdd")).val();
    			 
    					taskItemInfo = new SP.ListItemCreationInformation();
    					newTask = taskList.addItem(taskItemInfo);
    					newTask.set_item('UserDescription', userdesc);
    					newTask.set_item('UserFullName', userfullname);
    					newTask.set_item('UserAddress', UserAdd);
    					newTask.update();
    			 
    					ctx.load(newTask);
    					array.push(newTask);
    					
    					});
    					
    					ctx.executeQueryAsync(
    						function() {
    							// Successful
    							buildDeferredSaves.resolve();
    							},
    						function(sender, args) {
    							// Failure
    							buildDeferredSaves.reject(args.get_message());
    							}
    						);
    					//});
    				});
    			return buildDeferredSaves.promise();
    			}
        </script><div class="div_class_1" id="div_id_1"><table id="tbl_id_1"><tbody><tr id="tr_id_1"><td>UserDescription:<br/><select id="myselect"> <option value="1">UserDescription1</option> <option value="2">UserDescription2</option> <option value="3">UserDescription3</option></select> </td>
    <td>UserFullName:<br/><input class="userfullname" type="text"/></td>
    <td>UserAddress:<br/><input class="UserAdd" type="text"/></td></tr></tbody></table>
    <div><button id="btn_id_1" type="button" width="10" height="10" jquery1720317282770949942="1" jquery17207343635112884426="1" jquery17207762186444077934="1" jquery17208137162316068791="1" jquery17207359973804149977="1">+</button></div>
    <div><button id="btn_id_2" type="button" jquery1720317282770949942="2" jquery17207343635112884426="2" jquery17207762186444077934="2" jquery17208137162316068791="2" jquery17207359973804149977="2">Save</button></div></div>

    Output screen:

    Thanks

    Thursday, May 23, 2019 6:48 AM
  • Hi

    Will datasheet view help you?

    Seeing your above description its looks like you want all fields to displayed in a single row.

    Thanks


    • Marked as answer by sree_23 Monday, July 29, 2019 9:18 AM
    Thursday, May 23, 2019 11:08 AM