SoFunction
Updated on 2025-04-10

How to submit the form and layout text editing content of subpages

Mainly use the method of taking child page dom from the layer () to operate on the child page dom on the parent page

js code: Get the dom of the subpage in btn yes function(index, layero){ } to operate:

		$("a[name='editNews']").click(function() {
			({
				type: 2,
				title: 'edit',
				shadeClose: true,
				shade: 0.8,
				area: ['99%', '99%'],
				offset: ['2px'],
				content: '/gcsoft/news/?itemId=' + 
    $(this).attr("data-value"),
				btn: ['submit', 'Cancel'],
				yes: function(index, layero) {
 
     //The form of the subpage					var newsFrom = ('#newsFrom', index);
 
 
     //Layeidt LAY_layedit_1 of the subpagevar layeditCt = ('#LAY_layedit_1',index).contents().find('body');
 
     //Get the html tag in layout and assign the ID to the subpage definition as 'content' textarea					('#content', index).val(layeditCt[0].innerHTML);
 
 
					if(("#menuId").val() == '' || 
     ("#menuId").val() == -1 || ("#title").val() 
     == '') {
						('Title and column cannot be empty');
						return
					}
 
 
			  //ajax submission					$.ajax({
						type: "POST",
						dataType: "json",
						url: "/gcsoft/news/",
						data: (),//newsForm serialization						success: function(result) {
							('Save successfully!  ');
							();
						},
						error: function() {
							alert("abnormal!");
						}
					});
				},
				btn2: function() {
					();
				}
			});
		});

HTML code: Can be ignored and not viewed

 
	<div class="container-fluid">
		<div class="row-fluid">
				<div class="box">
				<nav aria-label="breadcrumb">
					 <ol class="breadcrumb">
					 <li class="breadcrumb-item"><a href="/gcsoft/news/" rel="external nofollow" >Information List</a></li>
					 <li class="breadcrumb-item active" aria-current="page">New/Modify information</li>
					 </ol>
			 </nav>
				<div>
				<div class="container">
				<form  class="form-horizontal input-prepend" method="post" >
				<div class="row">
				 <div class="col-sm-6">
				 <div class="input-group mb-4">
					 <div class="input-group-prepend">
					 <span class="input-group-text">News Title</span>
					 </div>
					 <input type="text" class="form-control"  name="title" value="<#if news ??>${}</#if>">
					</div>
				 </div>
				 
				 <div class="col-sm-6">
					<div class="input-group mb-3">
					 <div class="input-group-prepend">
					 <span class="input-group-text">author</span>
					 </div>
		    	<input type="text" class="form-control"  name="wen" value="<#if news ??>${}</#if>">
 						<span  class="help-inline"> </span>
					</div>				 
				 </div>
				 </div>
				<div class="row">
	 			 <div class="col-sm-4">
	 			 <div class="input-group mb-3">
				 <div class="input-group-prepend">
				 <label class="input-group-text" for="inputGroupSelect01">Level 1 column</label>
				 </div>
				 <select class="custom-select"  ><option value="-1">------------------ null ------------------ </option></select>   
				 </div>
	 			 </div>
				 <div class="col-sm-4">
				 <div class="input-group mb-3">
				 <div class="input-group-prepend">
				 <label class="input-group-text" for="inputGroupSelect01">Secondary column</label>
				 </div>
				 <select class="custom-select"  ><option value="-1">------------------ null ------------------ </option></select>   
				 </div>
				 </div>
				 <div class="col-sm-4">
				 <div class="input-group mb-3">
				 <div class="input-group-prepend">
				 <label class="input-group-text" for="inputGroupSelect01">Level 3 column</label>
				 </div>
				 <select class="custom-select" ><option value="-1">------------------ null ------------------ </option></select>   
				 </div>
				 </div>
				 <input type="hidden" check-type="required"  name="menuId" value="<#if news ??>${}<#else>0</#if>">
				</div>
				<div class="row">
	 			 <div class="col-sm-6">
	 			 <div class="input-group mb-3">
				 <input type="text" class="form-control" name="imgUrl"  value="<#if news ??>${}</#if>" >
				 <div class="input-group-append">
				 <button class="btn btn-outline-secondary" type="button" >Upload pictures</button>
				 <button class="btn btn-outline-secondary" type="button"  >Delete pictures</button>
				 </div>
				 </div>
	 			 </div>
				 <div class="col-sm-6">
	 			 <div class="input-group mb-3">
				 <input type="text" class="form-control" name="videoUrl"  value="<#if news ??>${}</#if>" >
				 <div class="input-group-append">
				 <button class="btn btn-outline-secondary" type="button" >Upload video</button>
				 <button class="btn btn-outline-secondary" type="button"  >Delete video</button>
				 </div>
				 </div>				 
				 </div>
				</div>
				<div class="row">
				 <div class="col-sm-3">
	 			 <div class="input-group mb-4">
				 <div class="input-group-prepend">
				 <label class="input-group-text" for="inputGroupSelect01">department</label>
				 </div>
				 <select class="custom-select" data-rel="chosen"  name="origin" value="<#if news ??>${}</#if>">
						<#if dept ??>
	    			<#list dept as domainInfo>
		    			<#if news ??>
									<#if  = >
			    				<option value="${}" selected="selected"> ${} </option>
			    			<#else>
			    				<option value="${}"> ${} </option>
			    			</#if>
			    		<#else>
			    			<option value="${}"> ${} </option>
								</#if>
	    			</#list>
	    		</#if>
	    	</select> 
				 </div>
	 			 </div>
				 <div class="col-sm-3">
					<div class="input-group mb-3">
					 <div class="input-group-prepend">
					 <span class="input-group-text">Publication time</span>
					 </div>
		    <input type="text" class="form-control datepicker"  name="itemTime" value="<#if news ??>${}</#if>">
 					 <span  class="help-inline"> </span>
					</div>				 
				 </div>	
				 			 
				 <div class="col-sm-2">
					<div class="input-group mb-3">
					 <div class="input-group-prepend">
					 <span class="input-group-text" >Sort</span>
					 </div>
					 <input type="text" class="form-control"  name="orderBy" value="<#if news ??>${}</#if>" οnkeyup="=(/\D/g,'')"/>
					</div>				 
				 </div>
				 
				 
				</div>
				<div class="row">
				<div class="col-sm-12" style="margin-bottom: 20px">
				<textarea name="content"  style="display: none;"><#if news ??>${}</#if></textarea>
							<div  style="top: 50px;left: 50px;">
							<div class="xheMenu">
								<a href="javascript:void('1')" rel="external nofollow" title="Extremely Small" v="1" role="option" aria-setsize="8" aria-posinset="1" tabindex="0"><span style="font-size:10px;">Extremely small(10px)</span></a>
								<a href="javascript:void('2')" rel="external nofollow" title="Extra small" v="2" role="option" aria-setsize="8" aria-posinset="2" tabindex="0"><span style="font-size:12px;">Very small(12px)</span></a>
								<a href="javascript:void('3')" rel="external nofollow" title="Small" v="3" role="option" aria-setsize="8" aria-posinset="3" tabindex="0"><span style="font-size:14px;">Small(14px)</span></a>
								<a href="javascript:void('4')" rel="external nofollow" title="default" v="4" role="option" aria-setsize="8" aria-posinset="4" tabindex="0"><span style="font-size:16px;">default(16px)</span></a>
								<a href="javascript:void('5')" rel="external nofollow" title="middle" v="5" role="option" aria-setsize="8" aria-posinset="5" tabindex="0"><span style="font-size:18px;">middle(18px)</span></a>
								<a href="javascript:void('6')" rel="external nofollow" title="big" v="6" role="option" aria-setsize="8" aria-posinset="6" tabindex="0"><span style="font-size:24px;">big(24px)</span></a>
								<a href="javascript:void('7')" rel="external nofollow" title="Extra large" v="7" role="option" aria-setsize="8" aria-posinset="7" tabindex="0"><span style="font-size:32px;">特big(32px)</span></a>
								<a href="javascript:void('8')" rel="external nofollow" title="great" v="8" role="option" aria-setsize="8" aria-posinset="8" tabindex="0"><span style="font-size:48px;">极big(48px)</span></a>
							</div>
						</div>	
				</div>
				</div>
				<input type="hidden"  name="itemId" value="<#if news ??>${}</#if>">
 
				</form>
				</div>									  
				</div>
				</div>		
		</div>
	</div>

The above method of sub-page form and layout text editing content is all the content I share with you. I hope you can give you a reference and I hope you can support me more.