We are now working on migrating the paper form to EspoCRM. There are some tables in the form and we found that tables can be made in the rich text field. Drop down list is added to limit the options of some fields in table and dropdown list will also be added to new row.
below is the code of the richtext field
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<table class="table table-bordered" cellspacing="0" bordercolor="black">
<tbody><thead><td><b><u>Description<br></u></b></td><td><b><u>Security LV. #<br></u></b></td><td><b><u>Server Name/Address *<br></u></b></td><td><b><u>Database<br></u></b></td><td><b><u>Login<br></u></b></td><td><b><u>Action (A/U/D)</u></b><br></td></thead>
<tr><td><input/><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
</tbody></table>
<script>
function addSecurityLevel(){
$("table tbody tr td:nth-child(2)").each(function(){
if ($(this).html().match(/(^<br\s*\/?>|<br\s*\/?>$)/i)){
$(this).html('<select><option value="1">1</option><option value="5">5</option><option value="10">10</option>');
}
});
}
$("table").on("DOMSubtreeModified", function (){
addSecurityLevel();
});
addSecurityLevel();
</script>
after richtext box saved, code is changed as below:
<table class="table table-bordered" cellspacing="0" bordercolor="black">
<tbody></tbody><thead><tr><td><b><u>Description<br></u></b></td><td><b><u>Security LV. #<br></u></b></td><td><b><u>Server Name/Address *<br></u></b></td><td><b><u>Database<br></u></b></td><td><b><u>Login<br></u></b></td><td><b><u>Action (A/U/D)</u></b><br></td></tr></thead>
<tbody><tr><td><input><br></td><td><select><option value="1">1</option><option value="5">5</option><option value="10">10</option></select></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><td><br></td><td><select><option value="1">1</option><option value="5">5</option><option value="10">10</option></select></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><td><br></td><td><select><option value="1">1</option><option value="5">5</option><option value="10">10</option></select></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><td><br></td><td><select><option value="1">1</option><option value="5">5</option><option value="10">10</option></select></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
</tbody></table>
function addSecurityLevel(){
$("table tbody tr td:nth-child(2)").each(function(){
if ($(this).html().match(/(^<br\s*\ ?="">|<br\s*\ ?="">$)/i)){
$(this).html('<select><option value="1">1</option><option value="5">5</option><option value="10">10</option>');
}
});
}
$("table").on("DOMSubtreeModified", function (){
addSecurityLevel();
});
addSecurityLevel();
</select></br\s*\></br\s*\>
It seems that script is not allowed in the rich text field, am i right?
How can we add drop down list to table and the drop down list will also shown in the new row? thanks.
below is the code of the richtext field
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<table class="table table-bordered" cellspacing="0" bordercolor="black">
<tbody><thead><td><b><u>Description<br></u></b></td><td><b><u>Security LV. #<br></u></b></td><td><b><u>Server Name/Address *<br></u></b></td><td><b><u>Database<br></u></b></td><td><b><u>Login<br></u></b></td><td><b><u>Action (A/U/D)</u></b><br></td></thead>
<tr><td><input/><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
</tbody></table>
<script>
function addSecurityLevel(){
$("table tbody tr td:nth-child(2)").each(function(){
if ($(this).html().match(/(^<br\s*\/?>|<br\s*\/?>$)/i)){
$(this).html('<select><option value="1">1</option><option value="5">5</option><option value="10">10</option>');
}
});
}
$("table").on("DOMSubtreeModified", function (){
addSecurityLevel();
});
addSecurityLevel();
</script>
after richtext box saved, code is changed as below:
<table class="table table-bordered" cellspacing="0" bordercolor="black">
<tbody></tbody><thead><tr><td><b><u>Description<br></u></b></td><td><b><u>Security LV. #<br></u></b></td><td><b><u>Server Name/Address *<br></u></b></td><td><b><u>Database<br></u></b></td><td><b><u>Login<br></u></b></td><td><b><u>Action (A/U/D)</u></b><br></td></tr></thead>
<tbody><tr><td><input><br></td><td><select><option value="1">1</option><option value="5">5</option><option value="10">10</option></select></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><td><br></td><td><select><option value="1">1</option><option value="5">5</option><option value="10">10</option></select></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><td><br></td><td><select><option value="1">1</option><option value="5">5</option><option value="10">10</option></select></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><td><br></td><td><select><option value="1">1</option><option value="5">5</option><option value="10">10</option></select></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
</tbody></table>
function addSecurityLevel(){
$("table tbody tr td:nth-child(2)").each(function(){
if ($(this).html().match(/(^<br\s*\ ?="">|<br\s*\ ?="">$)/i)){
$(this).html('<select><option value="1">1</option><option value="5">5</option><option value="10">10</option>');
}
});
}
$("table").on("DOMSubtreeModified", function (){
addSecurityLevel();
});
addSecurityLevel();
</select></br\s*\></br\s*\>
It seems that script is not allowed in the rich text field, am i right?
How can we add drop down list to table and the drop down list will also shown in the new row? thanks.
Comment