Skip to content

Commit 000d76c

Browse files
proper template id and additional fields to capture
1 parent 1a229ab commit 000d76c

File tree

2 files changed

+40
-6
lines changed

2 files changed

+40
-6
lines changed

src/components/app-profile-page/app-profile-page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ export class AppProfile {
5858
</tr>
5959
<tr>
6060
<td>stenciljs-components</td>
61-
<td>https://www.npmjs.com/package/stenciljs-components</td>
61+
<td><a href="https://www.npmjs.com/package/stenciljs-components" target="_blank">Visit</a></td>
6262
<td>1.0.7</td>
6363
</tr>
6464
<tr>
6565
<td>FLUID Library</td>
66-
<td>https://www.npmjs.com/package/fluid-library</td>
66+
<td><a href="https://www.npmjs.com/package/fluid-library" target="_blank">Visit</a></td>
6767
<td>1.0.4</td>
6868
</tr>
6969
</table>
@@ -75,7 +75,7 @@ export class AppProfile {
7575
</tr>
7676
<tr>
7777
<td>AWS</td>
78-
<td>https://www.credly.com/users/sanjeet-kumar.8f5d5b31</td>
78+
<td><a href="https://www.credly.com/users/sanjeet-kumar.8f5d5b31" target="_blank">Visit</a></td>
7979
</tr>
8080

8181
</table>

src/components/feedback-form/feedback-form.tsx

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,16 @@ export class FeedbackForm {
302302
}
303303
@State() editorContent: string = '';
304304
@State() responseMessage: string = '';
305-
305+
@State() userName: string = ''; // State to capture user's name
306+
@State() userEmail: string = ''; // State to capture user's email
307+
handleInputChange(event: Event, field: 'name' | 'email') {
308+
const input = event.target as HTMLInputElement;
309+
if (field === 'name') {
310+
this.userName = input.value;
311+
} else if (field === 'email') {
312+
this.userEmail = input.value;
313+
}
314+
}
306315
//Before performing any operations- GET or SET- ensure that the this.editor instance is available
307316
//send email also without backend
308317
async getContentFromEditor() {
@@ -331,13 +340,21 @@ export class FeedbackForm {
331340
this.responseMessage = 'Submission failed!';
332341
}
333342

343+
// Ensure all required fields are filled
344+
if (!this.userName || !this.userEmail || !this.editorContent) {
345+
alert('Please fill out all fields before submitting.');
346+
return;
347+
}
334348
// Call EmailJS to send the email (Browser based or client based)
335349
//Emailjs dashboard: https://dashboard.emailjs.com/sign-up
336350
//templateParams is this.editorContent
351+
//Template ID not found: https://dashboard.emailjs.com/admin/templates
337352
emailjs.send(
338353
'service_2q5gm3h', // Email service ID from EmailJS dashboard
339-
'template_rf0n5eq', // Template ID from EmailJS dashboard
340-
{ content: this.editorContent }, // Template parameters (the content of the email)
354+
'template_szeawas', // Template ID from EmailJS dashboard
355+
{ user_name: this.userName,
356+
user_email: this.userEmail,
357+
content: this.editorContent }, // Template parameters (the content of the email)
341358
{
342359
publicKey: 'IRGsyXDXq7ZJHMbzF',
343360
}// Your user ID from EmailJS: YOUR_PUBLIC_KEY
@@ -379,6 +396,23 @@ export class FeedbackForm {
379396
return (
380397
<div>
381398
<h1>Feedback Form</h1>
399+
<label>
400+
Name:
401+
<input
402+
type="text"
403+
placeholder="Enter your name"
404+
onInput={(event) => this.handleInputChange(event, 'name')}
405+
required/>
406+
</label>
407+
<br />
408+
<label>
409+
Email:
410+
<input
411+
type="email"
412+
placeholder="Enter your email"
413+
onInput={(event) => this.handleInputChange(event, 'email')}
414+
required/>
415+
</label>
382416
<div
383417
id={editorId}
384418
ref={(el: HTMLElement) => (this._targetRef = el)}

0 commit comments

Comments
 (0)