Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9154281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:24:11+00:00 2026-06-17T12:24:11+00:00

I have a form build up in javascript, which i want to use for

  • 0

I have a form build up in javascript, which i want to use for adding users and updating users.

The form holds some input elements like below. This works when i get the user data to build up the form for updating, but for adding a new user this property does not exists in the array so the script failed and stop running correctly, as expected.

The question is, what is the shortest way to suppress this error? Something php like @$params[‘user_email’].

  • i know about try, cache
  • i know about suppressing all errors on the window object.
  • type of, undefined etc.

I just looking for the shortest way to do this without adding multiple lines of code for validating each property in the params array.

<input name="user_email" type="text" value="'+params['user_email']+'"/>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:24:12+00:00Added an answer on June 17, 2026 at 12:24 pm

    NEVER suppress errors. It’s a very bad habit and will give you serious headaches rather sooner than later. Always do a proper check. (like following)

              // if available           use it            otherwise echo empty string
    value="'+(params['user_email'] ? params['user_email'] : '')+'"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have piece of JavaScript code which cycles through form elements and builds an
I have used form_tag to build a form, which display questions and answers for
I have a string build form comma separated values I use split to get
I have a HTML form which has 3 text input fields: id , name
I want to build a query that finds elements that have the autofocus-attribute and
I have an input which at some points happens to have the focus. If
I have form build with yii framework. The first 2 inputs is first_name and
I need to build a form where I have 2 comboBoxes . Select country
I am trying to build a registration form. I have a model for all
I tried to build an application using Javascript, HTML, CSS, AJAX, JSON in which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.