Form submission

This commit is contained in:
Vivek Teega 2020-07-04 08:58:20 +05:30
parent 92e63513f3
commit 166b41157a

View File

@ -102,7 +102,8 @@
<article id="work"> <article id="work">
<h2 class="major">Projects</h2> <h2 class="major">Projects</h2>
<span class="image main"><img src="images/pic02.jpg" alt="" /></span> <span class="image main"><img src="images/pic02.jpg" alt="" /></span>
<p>This is some random text which will be replaced with much more creative introduction to the Project List</p> <p>This is some random text which will be replaced with much more creative introduction to the Project
List</p>
<div id='projectlist'> <div id='projectlist'>
</div> </div>
</article> </article>
@ -121,7 +122,7 @@
<!-- Contact --> <!-- Contact -->
<article id="contact"> <article id="contact">
<h2 class="major">Apply</h2> <h2 class="major">Apply</h2>
<form method="post" action="#"> <form method="post" action="#" id='applicationform'>
<div class="fields"> <div class="fields">
<div class="field half"> <div class="field half">
<label for="name">Name</label> <label for="name">Name</label>
@ -132,24 +133,24 @@
<input type="text" name="email" id="email" /> <input type="text" name="email" id="email" />
</div> </div>
<div class="field half"> <div class="field half">
<label for="name">College</label> <label for="college">College</label>
<input type="text" name="name" id="name" /> <input type="text" name="college" id="college" />
</div> </div>
<div class="field half"> <div class="field half">
<label for="email">Course</label> <label for="course">Course</label>
<input type="text" name="email" id="email" /> <input type="text" name="course" id="course" />
</div> </div>
<div class="field half"> <div class="field half">
<label for="name">DOB</label> <label for="dob">DOB</label>
<input type="text" name="name" id="name" placeholder="DD/MM/YYYY" /> <input type="text" name="dob" id="dob" placeholder="DD/MM/YYYY" />
</div> </div>
<div class="field half"> <div class="field half">
<label for="email">WhatsApp Number</label> <label for="whatsapp">WhatsApp Number</label>
<input type="text" name="email" id="email" /> <input type="text" name="whatsapp" id="whatsapp" />
</div> </div>
<div class="field half"> <div class="field half">
<label for="email">*FLO ID</label> <label for="floid">*FLO ID</label>
<input type="text" name="email" id="email" /> <input type="text" name="floid" id="floid" />
</div> </div>
<!--<div class="field" style='display:"none"'> <!--<div class="field" style='display:"none"'>
<label for="message">Message</label> <label for="message">Message</label>
@ -158,18 +159,18 @@
</div> </div>
<ul class="actions"> <ul class="actions">
<li><input type="submit" value="Apply" class="primary" /></li> <li><input type="submit" value="Apply" class="primary" /></li>
<li><input type="reset" value="Reset" /></li> <li><input type="reset" value="Reset" id='resetform' /></li>
</ul> </ul>
</form> </form>
<ul class="icons"> <!--<ul class="icons">
<li><a href="https://twitter.com/ranchimallFLO" target="_blank" class="icon brands fa-twitter"><span <li><a href="https://twitter.com/ranchimallFLO" target="_blank" class="icon brands fa-twitter"><span
class="label">Twitter</span></a></li> class="label">Twitter</span></a></li>
<li><a href="https://facebook.com/ranchimall/" target="_blank" <li><a href="https://facebook.com/ranchimall/" target="_blank"
class="icon brands fa-facebook-f"><span class="label">Facebook</span></a></li> class="icon brands fa-facebook-f"><span class="label">Facebook</span></a></li>
<!--<li><a href="#" class="icon brands fa-instagram"><span class="label">Instagram</span></a></li>--> <li><a href="#" class="icon brands fa-instagram"><span class="label">Instagram</span></a></li>
<li><a href="https://github.com/ranchimall/" target="_blank" class="icon brands fa-github"><span <li><a href="https://github.com/ranchimall/" target="_blank" class="icon brands fa-github"><span
class="label">GitHub</span></a></li> class="label">GitHub</span></a></li>
</ul> </ul>-->
</article> </article>
<!-- Elements --> <!-- Elements -->
@ -9548,10 +9549,41 @@ print 'It took ' + i + ' iterations to sort the deck.';</code></pre>
<script> <script>
async function loadRIBC(){ /*async function loadRIBC() {
floCloudAPI.requestObjectData('RIBC', options = { senderIDs: false, receiverID: "FMeiptdJNtYQEtzyYAVNP8fjsDJ1i4EPfE", application: 'RIBC' }) floCloudAPI.requestObjectData('RIBC', options = { senderIDs: false, receiverID: "FMeiptdJNtYQEtzyYAVNP8fjsDJ1i4EPfE", application: 'RIBC' })
}*/
async function fetchInternApplicants() {
let applicants = await floCloudAPI.requestGeneralData('test')
debugger;
} }
//Handler for Applicant form submission
document.getElementById('applicationform').addEventListener('submit', (ev) => {
ev.preventDefault()
aname = document.getElementById('name').value
aemail = document.getElementById('email').value
acollege = document.getElementById('college').value
acourse = document.getElementById('course').value
adob = document.getElementById('dob').value
awhatsapp = document.getElementById('whatsapp').value
afloid = document.getElementById('floid').value
let detailsObj = {
'name' : aname,
'email' : aemail,
'college' : acollege,
'course' : acourse,
'dob' : adob,
'whatsapp' : awhatsapp
}
let mainObj = {}
mainObj[afloid] = detailsObj
floCloudAPI.sendGeneralData(JSON.stringify(mainObj), 'test1')
document.getElementById('resetform').click()
})
</script> </script>
@ -9567,15 +9599,24 @@ print 'It took ' + i + ' iterations to sort the deck.';</code></pre>
alert(`Welcome FLO_ID: ${myFloID}`) alert(`Welcome FLO_ID: ${myFloID}`)
//App functions.... //App functions....
loadRIBC() /*loadRIBC()
.then(loadres => { .then(loadres => {
}) */
let ribcAppdata = floCloudAPI.requestObjectData('RIBC', options = { senderIDs: false, receiverID: "FMeiptdJNtYQEtzyYAVNP8fjsDJ1i4EPfE", application: 'RIBC' })
let ribcGendata = floCloudAPI.requestGeneralData('test')
Promise.all([ribcAppdata, ribcGendata]).then((values) => {
console.log("Hey I'm here, the promises just got resolved")
console.log(values)
let projectDetails = floGlobals.appObjects.RIBC.projectDetails let projectDetails = floGlobals.appObjects.RIBC.projectDetails
let projectDetailsKeys = Object.keys(projectDetails) let projectDetailsKeys = Object.keys(projectDetails)
console.log('hey im here')
let projectlistContainer = document.getElementById('projectlist') let projectlistContainer = document.getElementById('projectlist')
for(let i=0; i<projectDetailsKeys.length; i++){ for (let i = 0; i < projectDetailsKeys.length; i++) {
newHtml = `<h4>${projectDetails[projectDetailsKeys[i]].projectName}</h4> newHtml = `<h4>${projectDetails[projectDetailsKeys[i]].projectName}</h4>
<p>${projectDetails[projectDetailsKeys[i]].projectDescription}</p>` <p>${projectDetails[projectDetailsKeys[i]].projectDescription}</p>`
@ -9583,7 +9624,8 @@ print 'It took ' + i + ' iterations to sort the deck.';</code></pre>
projectlistContainer.innerHTML = projectlistContainer.innerHTML + newHtml projectlistContainer.innerHTML = projectlistContainer.innerHTML + newHtml
} }
}) });
}).catch(error => console.error(error)) }).catch(error => console.error(error))
} }
</script> </script>