Dear All, Here is my link http://183.78.169.53/tm/layout.php. I have two button "Add Single" and "Add Double".What I want is that when I press the "Add Single" a new row add with the single drop down list and when I press "Add Double" I would like to have the row with two drop down list. How to achieve this ? In the begining must I hide both the rows is it? Now I have the relevant function ready for both buttons but I do not know how to add the rows accordingly. Finally I also want to make sure all the dropdown list values selected is different.

In addition I am planning to add a remove button so that I can remove the relevant rows accordingly and also I would like to validate before submit that none of the dropdown list have similar values selected.

PhilipToop
—
2011-07-05T07:25:52Z —
#4

The <select> that are in id="idsingle" and id="iddouble" do not have a name. That is when the form is sent to the server they are not included in the data stream. This loop is adding a name to each of the select elements found in the table row created. The name is of the format selp_n where p is 1 or 2 (2 in the case of double) and n is the row number.

newtomysql
—
2011-07-05T10:38:38Z —
#5

Dear Philip, Ok I am clear. How to go about with the validation? I would like to validate that all the dropdown list are selected and one of dropdown list from any of the rows are similar.

PhilipToop
—
2011-07-05T10:50:49Z —
#6

You have already started the process with your

onSubmit="return validateForm();"

Now you need to write the code for that function.

If you have problems whilst doing that then post a specific problem to this site.

newtomysql
—
2011-07-05T17:38:36Z —
#7

Dear Philip, I have added this two function. For the first function I want to remove the rows. But it tell me the window.event is undefined? Secondly validateForm I am trying to first read the dropdownlist name but none is appearing either? What I plan after reading the name check the value and give an error message. Can you help me check what is wrong here? Below is my changes with the remove button.

It is very powerful allowing you to do complicated operations simply and protect yourself against browser differences.

christajoe
—
2011-07-06T07:06:33Z —
#10

u can also use JBuilder to help you understand where actually u are facing problem..And as per philp Jquery is really useful or else try using SQL yog for MySql interface...

newtomysql
—
2011-07-06T10:38:07Z —
#11

Dear Philip, I will try working it on jquery. If you have related examples for me to work on please do let me know ya. So you idea is move to jquery and do not do it via javascript. Actually what is the danger with javascript by itself?

PhilipToop said:

Have you thought of using jQuery?

It is very powerful allowing you to do complicated operations simply and protect yourself against browser differences.

Paul_Wilkins
—
2011-07-06T11:02:39Z —
#12

newtomysql said:

So you idea is move to jquery and do not do it via javascript. Actually what is the danger with javascript by itself?

To head off any potential misunderstanding, jQuery is a code library written with JavaScript. The jQuery library provides cross-browser methods that help to simplify some aspects of scripting. They allow you to focus on writing your code, so that you don't have to deal with solving as many browser compatibility problems.

jQuery is just one of many code libraries that exist out there, such as Prototype, Dojo, YUI, and MooTools. They are all written in JavaScript, and they all use JavaScript to help piece things together.

newtomysql
—
2011-07-06T11:51:41Z —
#13

Dear Paul, Since jquery is based on JavaScript how it can work on acrossBrowser but why not JavaScript itself? The main library of jquery is found at jquery.com right?Then how about the plugin,jquery ui what are these how they work with jquery?

Paul_Wilkins
—
2011-07-06T11:59:26Z —
#14

newtomysql said:

Since jquery is based on JavaScript how it can work on acrossBrowser but why not JavaScript itself?

Because the jQuery library contains lots of code that checks for known compatibility issues, and does what it can to fix those problems.

So instead of you having to bust your brain trying to work out why it works here and not there, they have already put their best minds to the problem and fixed them for you.

newtomysql said:

The main library of jquery is found at jquery.com right?Then how about the plugin,jquery ui what are these how they work with jquery?

Those are user interface (ergo the UI) features and improvements that the are added on to the standard jQuery library.

newtomysql
—
2011-07-06T23:46:19Z —
#15

Dear Paul, Thank you for the details. Anyway I have manage to port over my codes to full jquery. The link is here http://183.78.169.53/tm/layout2.php. My only problem now is that after I have add either both the single or double drop down list I want to finally validate that neither of the dropdownlist have the same value. How to do that ? I would also in the begining would like to hide all the rows. Then I will clone from either the single or double prototype.

Paul_Wilkins
—
2011-07-06T23:48:38Z —
#16

newtomysql said:

Thank you for the details. Anyway

That is something I cannot help you with right now, but hopefully someone else will be able to.

newtomysql
—
2011-07-07T00:19:02Z —
#17

Dear Paul, Ok thank you. Is it something very tough or is not available via jquery yet?

Paul_Wilkins
—
2011-07-07T00:24:27Z —
#18

newtomysql said:

Dear Paul, Ok thank you. Is it something very tough or is not available via jquery yet?

To prevent any mistaken notions, it has nothing to do with any of that. Instead it is due to the situation that I am personally in at the moment.

newtomysql
—
2011-07-07T02:08:40Z —
#19

Dear Paul, No worries once you are fine will welcome your input.

Paul_Wilkins
—
2011-07-07T02:13:33Z —
#20

newtomysql said:

No worries once you are fine will welcome your input.

Do not wait for me. Someone else can help you with this if they are willing.