Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how ton give form widget to zoho creaor

function createForm(data='',text){
    if(data==''){
        data = {Student_ID:'',firstName:'', lastName:'', birthdate:'', grade:'', mentor:''};
    }

    let form = `<form  method="POST" id="dataForm">
        <input type="text" name="studentId" class="form-control" value="`+data.Student_ID+`" placeholder="Student ID" /><br/>
        <input type="text" name="fname" class="form-control" value="`+data.firstName+`" placeholder="First Name" /><br/>
        <input type="text" name="lname" class="form-control" value="`+data.lastName+`" placeholder="Last Name" /><br/>
        <input type="date" name="birthdate" class="form-control"  value="`+data.birthdate+`" placeholder="Birth Date" /><br/>
        <input type="text" name="grade" class="form-control" value="`+data.grade+`" placeholder="Grade" /><br/>        
        <input type="text" name="mentor" class="form-control" value="`+data.mentor+`" placeholder="Mentor" /><br/>        
        <input type="submit" value="`+text+`" /><input type="reset" />
    </form><br/>`;
    document.querySelector(".zmodal-header").innerHTML = "<h3>"+text+" Record</h3>";
    document.querySelector(".zmodal-body").innerHTML =  form;

    $("#dataForm").on("submit",function(e){
        e.preventDefault();
        
        record = $(this).serialize();        
        action = text.toLowerCase();

        if(action === 'add'){            
            addRecord(api, { formName: "StudentRecord", data: record });
        }else if(action === 'update'){
            id = record.id;
            delete record.id;
            updateRecord(api, { reportName:'StudentRecord', id:id, data:record });
        }
        
    });
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: d3 js date scatter plot 
Javascript :: listen to props deep change in vue js 2 
Javascript :: style mapbox paint data driven 
Javascript :: create upload preset using node.js on cloudinary 
Javascript :: js if on cellular network 
Javascript :: sentry configure scope 
Javascript :: should i have a webpack.config.js with yarn 
Javascript :: jquery show only first elements of table 
Javascript :: How to go back to previous route after authentication in nextjs 
Javascript :: random color by EventListener click 
Javascript :: how to compile javascript class to function 
Javascript :: how to change text of paragraph on click in java scriopt 
Javascript :: copy multi cell value from one sheet to another using google app script 
Javascript :: i in javascript 
Javascript :: realtime database get by field 
Javascript :: Expo Location Error: Unhandled promise rejection: Error: Not authorized to use background location services 
Javascript :: javascript How can i do optional function 
Javascript :: ziggy vue 3 
Javascript :: AngularJs: Display HTML elements from string variable in JSP page 
Javascript :: Angular after click add active class and remove from siblings 
Javascript :: AngularJS slick carousel filter by attribute 
Javascript :: Check if a user joins, leaves, or moves channels discord.js 
Javascript :: python regex consecutive characters 
Javascript :: how to hide prerendered page button in nextjs 
Javascript :: react native communications 
Javascript :: json array form to list object java 
Javascript :: code with mosh swipable react native not working 
Javascript :: Creating getLastBlock Object for blockchain 
Javascript :: underscore js 
Javascript :: react_devtools_backend.js:4026 Warning: Cannot update a component (`BrowserRouter`) while rendering a different component (`Login`). 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =