Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Option list onclick issue

Guest
Oct 27, 2011 Oct 27, 2011

Hello all,

I have a database full of data, and I am in the process of creating a page that either adds to or updates this data.

I have an option list of entities that I want to keep data for in the database.  I am looking at either designing an

"onclick" method to bring up the data via AJAX.  But that's a lot of database activity with clicking each option.

My other, probably easier way of programming it would be to have an action page for updating the data

by using the onclick method calling the action page, or I can make it really simple by putting a button

on the side and then you click that button once you highlight the entity you want to update. 

So, the form will initially come up ready for adding to the database.  The onclick or select and press

the button will bring up the update page.  I was thinking the cleanest and easiest way to do this

is using the button and the update page.

Does this sound reasonable to you?

Thanks!

938
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Oct 27, 2011 Oct 27, 2011

It was a little hard to tell from your post what exactly you are going for.  It sounds like you have an input form that will either a) create a new record in your database table or b) update an existing record in your table depending on whether a ID is passed into the page.  And you plan on having your existing IDs stored in a drop down box that lists each one.  Does that about sum it up?

There are any number of solutions that will get this done.  The solution you proposed (if I read your post correctly) will work - however it has some scalability issues.  What happens when your database table grows and your drop down box gets REALLY long?  Is that a concern?  Using a single form page for the insert/update action is a pretty common design pattern, so no real problem with that - though I'm sure there are other design patterns that might fit your requirements (master/detail maybe).

Regardless of whether your form submits via ajax and loads in page or you submit the data to an action page, addressing whether or not a drop down box is the most appropriate control here is probably the most important issue.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 27, 2011 Oct 27, 2011

Having a separate submit button as you suggest in the second paragraph increases the useability of your page in two ways.

First, anyone who accidentally selects the wrong item has a chance to correct their mistake before submitting the form.

Second, people who use their keyboard instead of their mouse to make their selection will not get frustrated by unintentional form submissions.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 27, 2011 Oct 27, 2011

Thanks guys!  I wanted to get some opinions, and what I think I will do is put a "View" button like I was thinking, and then bring up the record if one exists, or put out a message that no record exists and for the user to add a new record for that entity.  The update page then would let you update the record.  It's only going to be a finite size, so there won't be any more than 30 records for the database.  I just wasn't a fan of clicking on the item and having the javascript perform an onclick action and refresh the page.  I think there's too much room for error and it just wouldn't look clean.

Thanks again!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 27, 2011 Oct 27, 2011
LATEST

If it will never be more than 2 or 3 dozen records, you may consider an approach that I sometimes use.  It's a single data entry form.  At the top are a few rows that allow the user to add new records.  Then all the records are presented for editing.

The coding is a bit more complicated, but it makes it easier for the user to make mulitple edits.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources