Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@monster_property_services/monster-job-form
Advanced tools
This is a web component with a standard form to handle job requests. The logic to submit the data to a service must be handled by the user of this component.
This web component is a default form for receiving job applications. The form logic must be handled by the user of the web component.
You can start using this component right away like this:
<script type="module" src="https://unpkg.com/@monster_property_services/monster-job-form@1.1.0"></script>
npm i @monster_property_services/monster-job-form
The job form have a required input called successfulSubmit
in which the user can control the state of the form.
like this:
sending: 'the user is filling out the form'
success: 'the form was sent successfully'
fail: 'the form submission failed'
By default (initially) you have to set the successfulSubmit
to sending
.
<monster-job-form successfulSubmit="sending"></monster-job-form>
You can handle the data submitted with the event name form-submit
<monster-job-form successfulSubmit="sending"></monster-job-form>
<script>
const formElement = document.querySelector('monster-job-form');
formElement.addEventListener('form-submit', (event) => {
console.log(event.detail); // Your form data
// Your api implementation goes here
if(success) {
formElement.setAttribute('successfulSubmit', 'success');
} else {
formElement.setAttribute('successfulSubmit', 'fail');
}
});
</script>
If the form is been correctly submitted you should get an object like this
{
"firstName": "Jhon",
"email": "john@mail.com",
"address": "312 Skeep road",
"province": "Ontario",
"lastName": "Doe",
"phone": "444-115-5522",
"city": "Toronto",
"postalCode": "M3S SS6",
"pastExperience": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Possimus sunt voluptatem ut odit exercitationem eaque ducimus repellat. Quod, facere sequi quae, voluptatibus nobis architecto repellat est quam placeat eos voluptates!",
"greatFit": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Possimus sunt voluptatem ut odit exercitationem eaque ducimus repellat. Quod, facere sequi quae, voluptatibus nobis architecto repellat est quam placeat eos voluptates!",
"position": "Senior Team Leader/Plow Operator",
"driversLicense": "Ontario G",
"ageOver25": "Yes",
"experience": "None",
"tickets": "None",
"source": "Word of Mouth",
"cv": {}
}
You can use your own google reCaptcha implementation like this:
hasCaptcha
with a true
string value.
Moreover, you'll have to render the captcha element as a child of monster-job-form
.<monster-job-form hasCaptcha="true">
<div id="html_element" style="margin: 0 auto"></div>
</monster-job-form>
<script>
var onloadCallback = function() {
grecaptcha.render('html_element', {
'sitekey' : 'your-site-key',
});
};
const formElement = document.querySelector('monster-job-form');
formElement.addEventListener('form-submit', (event) => {
console.log(event.detail);
});
</script>
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>
{
"form": {
"firstName": "Jhon",
"email": "john@mail.com",
"address": "312 Skeep road",
"province": "Ontario",
"lastName": "Doe",
"phone": "444-115-5522",
"city": "Toronto",
"postalCode": "M3S SS6",
"pastExperience": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Possimus sunt voluptatem ut odit exercitationem eaque ducimus repellat. Quod, facere sequi quae, voluptatibus nobis architecto repellat est quam placeat eos voluptates!",
"greatFit": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Possimus sunt voluptatem ut odit exercitationem eaque ducimus repellat. Quod, facere sequi quae, voluptatibus nobis architecto repellat est quam placeat eos voluptates!",
"position": "Senior Team Leader/Plow Operator",
"driversLicense": "Ontario G",
"ageOver25": "Yes",
"experience": "None",
"tickets": "None",
"source": "Word of Mouth",
"cv": {}
},
"captcha": 'your-recaptcha-token-response or null in case there is no recpatcha'
}
Here an example of a full implementation with captcha and feedback control:
<body style="font-family: Oswald;">
<monster-job-form successfulSubmit="sending" hasCaptcha="true">
<div id="html_element" style="margin: 0 auto"></div>
</monster-job-form>
</body>
<script>
var onloadCallback = function() {
grecaptcha.render('html_element', {
'sitekey' : 'your_captcha_key',
});
};
const formElement = document.querySelector('monster-job-form');
formElement.addEventListener('form-submit', (event) => {
grecaptcha.reset();
const {name, email, message} = event.detail;
fetch("your_api_url", {
method: 'POST',
body: {
FullName: name,
Email: email,
Message: message
},
headers: {
'Authorization': `Bearer your_api_token`,
'Content-Type': 'application/json'
}
})
.then((response) => {
const objectResponse = response.json();
if(!response.ok) {
throw new Error('Request failed');
}
formElement.setAttribute('successfulSubmit', 'success');
})
.catch(error => {
formElement.setAttribute('successfulSubmit', 'fail');
});
});
</script>
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>
There's an example of this in here https://codepen.io/Andres2D/pen/mdYRWaK
FAQs
This is a web component with a standard form to handle job requests. The logic to submit the data to a service must be handled by the user of this component.
We found that @monster_property_services/monster-job-form demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.