/    Sign up×
Community /Pin to ProfileBookmark

dynamically add rows to order form?

Hi All!

I have seen a form made in InfoPath, and it has the ability to dynamically create rows in an order form (the user clicks a button and a popup menu gives them the option).

I was wondering if I can add that functionality to HTML form.

Has anyone done something like this before?

THANKS! any info would be appreciated!?

to post a comment
HTML

42 Comments(s)

Copy linkTweet thisAlerts:
@PeOfEoJan 04.2005 — HTML does not have that kind of functionality. You can add additional feilds using javascript or a server side language. I would say do it server side for obvious accessibility reasons.
Copy linkTweet thisAlerts:
@simpson97Jan 05.2005 — Heres a rudimentary javascript example:

<html>

<head>

<script>

<!-- //

id='1';

function addInput(obj)

{

tablebody = document.getElementById('mytbody');

row = document.createElement("TR");

cell = document.createElement("TD");

cell.appendChild(document.createTextNode('text' + id));

row.appendChild(cell);

cell = document.createElement("TD");

cell.setAttribute("id",'value' + id)

inputEl = document.createElement("INPUT");

inputEl.setAttribute("id","userInput");

inputEl.setAttribute("value",'Input text' + id)

inputEl.setAttribute("name", 'name' + id);


cell.appendChild(inputEl);

row.appendChild(cell);

tablebody.appendChild(row);

id++;

}

function test()

{

obj = document.forms[0];

mystr = "";

for (i = 0; i < obj.elements.length; i++)

{

mystr += obj.elements[i].name + "=" + obj.elements[i].value + "&";

}

document.forms[1].mytext.value = mystr;

}

// -->

</script>

</head>

<body>

<form name='myform'>

<table>

<tbody id='mytbody'>

<tr>

<td>

text0

</td>

<td>

<input type='text' name='name0' value='Input text0'>

</td>

</tr>

</tbody>

</table>

</form>

<form>

<input type=button value='Add row to form' onclick='addInput(this.form)'>

<input type=button value='Test form' onclick='test()'><br />

<textarea name=mytext rows=12 cols=50>

</textarea>

</form>

</body>

</html>



Bob
Copy linkTweet thisAlerts:
@phpnoviceJan 05.2005 — [i]Originally posted by sanjuT [/i]

[B]I was wondering if I can add that functionality to HTML form.



Has anyone done something like this before?[/B]
[/QUOTE]

How do you know they weren't using server-side code to add the rows? At any rate, as stated... To do that client-side would require DHTML (i.e., combining HTML with a client-side scripting language) -- which I have done. I have also done the server-side method, too.
Copy linkTweet thisAlerts:
@PeOfEoJan 05.2005 — [i]Originally posted by phpnovice [/i]

[B]How do you know they weren't using server-side code to add the rows? At any rate, as stated... To do that client-side would require DHTML (i.e., combining HTML with a client-side scripting language) -- which I have done. I have also done the server-side method, too. [/B][/QUOTE]
And which do you think is better for accessibility reasons? ?

I just want some repetition to get my point across :p

PS: I have done this too, but I have always done it server side.
Copy linkTweet thisAlerts:
@phpnoviceJan 05.2005 — I believe that site's like this one should be for the purpose of providing technical answers. Period. I will not speak to propaganda nor to someone else's agenda.
Copy linkTweet thisAlerts:
@sanjuTauthorJan 05.2005 — thanks simpson, i tried it and it produces new text boxes, and i see from the code it is a new row.

is tbody table body? i have never used that before.

if i wanted more form elements, text, etc to be reproduced with each row, is it somewhere in this part:

<i>
</i>inputEl = document.createElement("INPUT");
inputEl.setAttribute("id","userInput");
inputEl.setAttribute("value",'Input text' + id)
inputEl.setAttribute("name", 'name' + id);


thanks peo and php for your ideas.
Copy linkTweet thisAlerts:
@phpnoviceJan 05.2005 — To document:
<i>
</i>function addInput(obj)
{
tablebody = document.getElementById('mytbody'); // create obj reference
row = document.createElement("TR"); // create table row object
cell = document.createElement("TD"); // create table cell object
cell.appendChild(document.createTextNode('text' + id)); // create and add text node to cell
row.appendChild(cell); // add cell to row

// loop on the following section for multiple form fields

cell = document.createElement("TD"); // create table cell object
cell.setAttribute("id", 'value' + id); // set cell id
inputEl = document.createElement("INPUT"); // create form input object
// default input object type = "text"
inputEl.setAttribute("id", "userInput"); // set input id
inputEl.setAttribute("value", 'Input text' + id); // set input value
inputEl.setAttribute("name", 'name' + id); // set input name
cell.appendChild(inputEl); // add for input object to cell
row.appendChild(cell); // add cell to row

// end loop section

tablebody.appendChild(row); // add row to table
id++;
}
Copy linkTweet thisAlerts:
@sanjuTauthorJan 05.2005 — [i]Originally posted by phpnovice [/i]

[B]To document:

<i>
</i>function addInput(obj)
{
tablebody = document.getElementById('mytbody'); // create obj reference
row = document.createElement("TR"); // create table row object
cell = document.createElement("TD"); // create table cell object
cell.appendChild(document.createTextNode('text' + id)); // create and add text node to cell
row.appendChild(cell); // add cell to row

// loop on the following section for multiple form fields

cell = document.createElement("TD"); // create table cell object
cell.setAttribute("id", 'value' + id); // set cell id
inputEl = document.createElement("INPUT"); // create form input object
// default input object type = "text"
inputEl.setAttribute("id", "userInput"); // set input id
inputEl.setAttribute("value", 'Input text' + id); // set input value
inputEl.setAttribute("name", 'name' + id); // set input name
cell.appendChild(inputEl); // add for input object to cell
row.appendChild(cell); // add cell to row

// end loop section

tablebody.appendChild(row); // add row to table
id++;
}
[/B][/QUOTE]



THANKS! one question:

why is the default input object type a textbox? can i have mult. elements?
Copy linkTweet thisAlerts:
@phpnoviceJan 05.2005 — [i]Originally posted by sanjuT [/i]

[B]why is the default input object type a textbox? can i have mult. elements? [/B][/QUOTE]

I haven't used this method before (I've always created HTML via [B]innerHTML[/B]), so try these:
<i>
</i>inputEl = document.createElement("&lt;INPUT TYPE=BUTTON&gt;");
inputEl = document.createElement("&lt;INPUT TYPE=FILE&gt;");
inputEl = document.createElement("&lt;INPUT TYPE=TEXT&gt;");
inputEl = document.createElement("&lt;INPUT TYPE=PASSWORD&gt;");
inputEl = document.createElement("&lt;INPUT TYPE=RADIO&gt;");
inputEl = document.createElement("&lt;INPUT TYPE=RESET&gt;");
inputEl = document.createElement("&lt;INPUT TYPE=SUBMIT&gt;");
Copy linkTweet thisAlerts:
@simpson97Jan 05.2005 — Heres an example of multiple tags:

http://www.simpsonscripts.com/enigma/exercize.html

Bob
Copy linkTweet thisAlerts:
@PeOfEoJan 06.2005 — [i]Originally posted by phpnovice [/i]

[B]I believe that site's like this one should be for the purpose of providing technical answers. Period. I will not speak to propaganda nor to someone else's agenda. [/B][/QUOTE]
Since when is this propaganda or someone elses agenda? And since when is this not a technical answer? Our purpose is to help people here, correct? So why would you not give people the correct answer? Client side is incorrect for this application because of obvious accessibility reasons. I do not see how you could denigh that. Once again, how is this my agenda or propaganda?
Copy linkTweet thisAlerts:
@phpnoviceJan 06.2005 — [i]Originally posted by PeOfEo [/i]

[B]...why would you not give people the correct answer?[/B][/QUOTE]

To give the kind of answer you're lobbying for, requires a judgement call. Who decides what is the "correct" answer? Those who try to decide such things for others are subject to propaganda and to sombody else's agenda. Every lobbyist has an agenda and the lobbyist's tool is propaganda.

Thus, I will stick to giving the technical answer for the question actually asked -- and leave the judgement calls up to the person implementing the technical answers given. There are oh so many reasons I could give you as to why your answer is the wrong one. However, you have already made your judgement call and are, thus, biased to not truly hear other views.

Now, why don't you leave off hijacking this person's thread for your own agenda?
Copy linkTweet thisAlerts:
@PeOfEoJan 07.2005 — [i]Originally posted by phpnovice [/i]

[B]To give the kind of answer you're lobbying for, requires a judgement call. Who decides what is the "correct" answer? Those who try to decide such things for others are subject to propaganda and to sombody else's agenda. Every lobbyist has an agenda and the lobbyist's tool is propaganda.



Thus, I will stick to giving the technical answer for the question actually asked -- and leave the judgement calls up to the person implementing the technical answers given. There are oh so many reasons I could give you as to why your answer is the wrong one. However, you have already made your judgement call and are, thus, biased to not truly hear other views.



Now, why don't you leave off hijacking this person's thread for your own agenda? [/B]
[/QUOTE]
Phpnovice, this is no hyjacking a thread. You fail to realize that me suggesting a server side language [b]is a technical answer[/b] even though I am not posting code. Just because I am trying to get the point accross that server side is a more accessible solution, which is a proven fact and very logical, does not mean that I am trying to get him to do this because of my own agenda (when you use a word like agenda it has a connotation that I would gain from this). Why don't you stop using charged words and stop ignoring suggestions and work towards accessibility? How is my answer wrong, you said you have reasons? Honestly, doing this with javascript is wrong because [b]it will fail for a % of the internet[/b]. For every 100 hits, statistically speaking, this form is going to fail for around 5 of them. Now ask yourself, would you want parts of your site, essential parts to fail for those people?

How about you start considering and being more open to the comments and suggestions by other members on this forum instead of shooting them down as something that is not technical or hijacking, or even just being sarcastic about it? It is extremely rude.


sanjuT, what server side languages do you have available, I might be able to help you do this server side if you wish.
Copy linkTweet thisAlerts:
@phpnoviceJan 07.2005 — [i]Originally posted by PeOfEo [/i]

[B]How about you start considering and being more open to the comments and suggestions by other members on this forum instead of shooting them down as something that is not technical or hijacking, or even just being sarcastic about it? It is extremely rude.[/B][/QUOTE]

Talk about who is being rude and who is shooting whom down... [b][u][i]You[/i][/u][/b] are the jerk that jumped in on my other thread and stated right off the bat that my example was "wrong". That is neither a comment nor a suggestion. That is an [u]accusation[/u] based on a judgement call using your own agenda and propaganda. There is [u][i]nothing[/i][/u] technical about such a statement. When [b][u][i]you[/i][/u][/b] learn how to talk considerately to people, [b][u][i]then[/i][/u][/b] they will be a little more open minded to you.

In [b][u][i]this[/i][/u][/b] thread, again, you weren't making either a comment or a statement. You tried to elicit a response from me that was in line with your agenda and in support of your propaganda. My response was that I won't lower myself to that level. You didn't like that, so now you're trying to accuse me of not being open minded. I think you need to get your facts straight.
Copy linkTweet thisAlerts:
@PeOfEoJan 07.2005 — [i]Originally posted by phpnovice [/i]

[B]Talk about who is being rude and who is shooting whom down... [b][u][i]You[/i][/u][/b] are the jerk that jumped in on my other thread and stated right off the bat that my example was "wrong". That is neither a comment nor a suggestion. That is an [u]accusation[/u] based on a judgement call using your own agenda and propaganda. There is [u][i]nothing[/i][/u] technical about such a statement. When [b][u][i]you[/i][/u][/b] learn how to talk considerately to people, [b][u][i]then[/i][/u][/b] they will be a little more open minded to you.[/b][/quote]
I am being considerite to the op. Also, your code was wrong, that is a criticism, and should not be taken as an insult. My calling you wrong is not the same as say me calling you stupid. Me calling you wrong and telling you what would make it correct is me trying to fix a problem.
[b]

In [b][u][i]this[/i][/u][/b] thread, again, you weren't making either a comment or a statement. You tried to elicit a response from me that was in line with your agenda and in support of your propaganda. My response was that I won't lower myself to that level. You didn't like that, so now you're trying to accuse me of not being open minded. I think you need to get your facts straight. [/B]
[/QUOTE]
Propoganda? How so, how is this my agenda or propoganda? How would I benefit from you giving me an answer. The reason I asked you is because you said you have done this both server side and client side. I want to get the point accross that this done client side [b]will[/b] be inaccessible for users. That is why I asked you, because I feel it is absolutly neccessary that thing be done right. You are the one who does not have the facts straight if you cannot see obvious accessibility issues.
Copy linkTweet thisAlerts:
@sanjuTauthorJan 07.2005 — [i]Originally posted by PeOfEo [/i]

[B]Phpnovice, this is no hyjacking a thread. You fail to realize that me suggesting a server side language [b]is a technical answer[/b] even though I am not posting code. Just because I am trying to get the point accross that server side is a more accessible solution, which is a proven fact and very logical, does not mean that I am trying to get him to do this because of my own agenda (when you use a word like agenda it has a connotation that I would gain from this). Why don't you stop using charged words and stop ignoring suggestions and work towards accessibility? How is my answer wrong, you said you have reasons? Honestly, doing this with javascript is wrong because [b]it will fail for a % of the internet[/b]. For every 100 hits, statistically speaking, this form is going to fail for around 5 of them. Now ask yourself, would you want parts of your site, essential parts to fail for those people?



How about you start considering and being more open to the comments and suggestions by other members on this forum instead of shooting them down as something that is not technical or hijacking, or even just being sarcastic about it? It is extremely rude.





sanjuT, what server side languages do you have available, I might be able to help you do this server side if you wish. [/B]
[/QUOTE]



i can use java servlets or ASP (V?.
Copy linkTweet thisAlerts:
@phpnoviceJan 07.2005 — [i]Originally posted by PeOfEo [/i]

[B]...if you cannot see obvious accessibility issues. [/B][/QUOTE]
Accessibility issues isn't the point. If they were, the person asking the question would have asked for a solution that takes into account accessibility issues. You and Charles (to name only two) should stop applying ruler-sized laws with a 12-foot two-by-four. Those laws only apply in certain instances. THEY DO NOT APPLY TO EVERYONE THAT CREATES A WEBSITE.
Copy linkTweet thisAlerts:
@sanjuTauthorJan 07.2005 — [i]Originally posted by simpson97 [/i]

[B]Heres an example of multiple tags:



http://www.simpsonscripts.com/enigma/exercize.html



Bob [/B]
[/QUOTE]


i don't think that site is working.
Copy linkTweet thisAlerts:
@PeOfEoJan 07.2005 — [i]Originally posted by phpnovice [/i]

[B]Accessibility issues isn't the point. If they were, the person asking the question would have asked for a solution that takes into account accessibility issues. You and Charles (to name only two) should stop applying ruler-sized laws with a 12-foot two-by-four. Those laws only apply in certain instances. THEY DO NOT APPLY TO EVERYONE THAT CREATES A WEBSITE. [/B][/QUOTE]
As I posted in the other thread, they do. Accessibility is everything. I do not understand why you would want your site not to work for some of your users....
Copy linkTweet thisAlerts:
@phpnoviceJan 07.2005 — [i]Originally posted by PeOfEo [/i]

[B]As I posted in the other thread, they do.[/B][/QUOTE]

I don't believe you. I've read it and I don't see where it applies to everyone -- I only read that it applies to federal agencies. Specify where it says "everyone".
Copy linkTweet thisAlerts:
@PeOfEoJan 07.2005 — [i]Originally posted by sanjuT [/i]

[B]Hi All!



I have seen a form made in InfoPath, and it has the ability to dynamically create rows in an order form (the user clicks a button and a popup menu gives them the option).



I was wondering if I can add that functionality to HTML form.



Has anyone done something like this before?



THANKS! any info would be appreciated!? [/B]
[/QUOTE]
okay, I know asp so let me answer this with it. So is the user going to select an option that will dictate the number of rows added?

it is going to be something like this, after the user selects the option they are going to hit a submit button in a form with a similar action to this

<form action="yourpage.asp" method="post">

and the page will be resent and the script will be like this

inputname=Request.Form("inputname")

and then it is going to take that input be the value a loop will loop to to print out the feilds, each with a name that will change with the value of the loop's counting variable. If you would like to do it this way I can provide some actual code for it.
Copy linkTweet thisAlerts:
@sanjuTauthorJan 10.2005 — [i]Originally posted by PeOfEo [/i]

[B]okay, I know asp so let me answer this with it. So is the user going to select an option that will dictate the number of rows added?



it is going to be something like this, after the user selects the option they are going to hit a submit button in a form with a similar action to this

<form action="yourpage.asp" method="post">



and the page will be resent and the script will be like this

inputname=Request.Form("inputname")



and then it is going to take that input be the value a loop will loop to to print out the feilds, each with a name that will change with the value of the loop's counting variable. If you would like to do it this way I can provide some actual code for it. [/B]
[/QUOTE]


Thanks peofeo!! that sounds like it would work for me. I was originally thinking of having a button labeled 'Add row' where the row is dynamically generated imediately when the user clicks the button (no page reload). I also wanted any dollar amounts that are entered in the new row to be added to a 'Total' textbox.

I can do totals already, but wasn't sure if it would work when new rows are added (i guess like u said, a loop to check for a new dollar amount).

But i guess since the user would already know how many rows to add, i can use what you are offering. I might just have a 'Page 1' type thing asking the user how many items are in the order, then it submits this info to the actual form page, where the number of rows match the number of items.

If you can supply the code that u mentioned, I'd be extremely greatful.

THANKS!!!!!?
Copy linkTweet thisAlerts:
@PeOfEoJan 11.2005 — I will have to work on it a little later but I can. I guess you will need the code for page 1 and the code for the loop to print the extra inputs?
Copy linkTweet thisAlerts:
@sanjuTauthorJan 11.2005 — [i]Originally posted by PeOfEo [/i]

[B]I will have to work on it a little later but I can. I guess you will need the code for page 1 and the code for the loop to print the extra inputs? [/B][/QUOTE]


Yes, the code to display the proper # of rows would be great!

Each row would have a textfield (separate <td>'s i think) for 6 inputs. The last textfield would be 'Price', so I would need to be able to use this for totaling. I have code that will do totals.

I guess the first page would just basically be a dropdown list of numbers for the user to select, correct? then we pass that value to the loop in the main form?

THANKS for all your help!
Copy linkTweet thisAlerts:
@PeOfEoJan 12.2005 — Basically your select number page is pretty simple, it can just be a plain html page if you like. Here is some code
<i>
</i>&lt;body&gt;
&lt;form action="yourform.asp" method="post"&gt;
&lt;select name="number"&gt;
&lt;option value="1"&gt;1&lt;/option&gt;
&lt;option value="2"&gt;2&lt;/option&gt;
&lt;option value="3"&gt;3&lt;/option&gt;
&lt;option value="4"&gt;4&lt;/option&gt;
&lt;option value="5"&gt;5&lt;/option&gt;
&lt;option value="6"&gt;6&lt;/option&gt;
&lt;/select&gt;
&lt;input type="submit" value="Submit"/&gt;
&lt;/form&gt;
&lt;/body&gt;


The form page would have to be asp
<i>
</i>&lt;body&gt;
&lt;table&gt;
&lt;%
dim numrows
numrows=Request.Form("number")
dim i
For i=1 to numrows
%&gt;
&lt;tr&gt;&lt;td&gt;&lt;input type="text" name="usernum&lt;% response.write(i) %&gt;" size="20"&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;%
Next
%&gt;
&lt;/table&gt;
&lt;/body&gt;

If you notice the name is usernum1, 2, 3, and so on. I have the name incrimenting so you do not have duplicate feilds and have problems when you try to request that value.

Now, if you want to use that number the user selected later you can at the top of the asp page drop that into the session temporarily or something to be used on this page and other pages. You can add up those form values client side to show the user, but It would be easy and safe to also do that server side when you process this form.

You can see these nuggets of code in action on my server:

http://quasi-ke.servebeer.com/sampleaps/selectnum.asp
Copy linkTweet thisAlerts:
@phpnoviceJan 12.2005 — [i]Originally posted by PeOfEo [/i]

[B]Basically your select number page is pretty simple, it can just be a plain html page if you like. Here is some code

<i>
</i>&lt;body&gt;
&lt;form action="yourform.asp" method="post"&gt;
&lt;select name="number"&gt;
&lt;option value="1"&gt;1&lt;/option&gt;
&lt;option value="2"&gt;2&lt;/option&gt;
&lt;option value="3"&gt;3&lt;/option&gt;
&lt;option value="4"&gt;4&lt;/option&gt;
&lt;option value="5"&gt;5&lt;/option&gt;
&lt;option value="6"&gt;6&lt;/option&gt;
&lt;/select&gt;
&lt;input type="submit" value="Submit"/&gt;
&lt;/form&gt;
&lt;/body&gt;

[/B][/QUOTE]

The "big talker" can't even supply valid HTML himsmelf. What a joke you are. You have a lot of gaul to criticize others with your talk of valid HTML and you can't even supply same yourself.

By the way... Don't even try to use any excuses along the lines of this being only a BODY section and, therefore, the standard for some lower version of HTML may be applied to it. The markup I supplied in the other thread (which you had the gaul to criticize) was also an incomplete page which did not indicate the version of HTML. So, have the decency (if you have any -- which I doubt you do) to apply the same standards to yourself as you apply to others.
This page is not Valid -//W3C//DTD HTML 4.01 Strict//EN!

Below are the results of attempting to parse this document with an SGML parser.

Line 11, column 21: document type does not allow element "SELECT" here; missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "DIV", "ADDRESS" start-tag

<select name="number">

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

&#9993;

Line 19, column 35: document type does not allow element "INPUT" here; missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "DIV", "ADDRESS" start-tag

<input type="submit" value="Submit"/>

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

&#9993;

Line 19, column 36: character data is not allowed here

<input type="submit" value="Submit"/>

You have used character data somewhere it is not permitted to appear. Mistakes that can cause this error include putting text directly in the body of the document without wrapping it in a container element (such as a <p>aragraph</p>) or forgetting to quote an attribute value (where characters such as "%" and "/" are common, but cannot appear without surrounding quotes).

&#9993;

Line 20, column 6: end tag for "FORM" which is not finished

</form>

Most likely, You nested tags and closed them in the wrong order. For example <p><em>...</p> is not acceptable, as <em> must be closed before <p>. Acceptable nesting is: <p><em>...</em></p>

Another possibility is that you used an element (e.g. 'ul') which requires a child element (e.g. 'li') that you did not include. Hence the parent element is "not finished", not complete.

&#9993; [/quote]
Copy linkTweet thisAlerts:
@PeOfEoJan 12.2005 — [i]Originally posted by phpnovice [/i]

[B]The "big talker" can't even supply valid HTML himsmelf. What a joke you are. You have a lot of gaul to criticize others with your talk of valid HTML and you can't even supply same yourself.



By the way... Don't even try to use any excuses along the lines of this being only a BODY section and, therefore, the standard for some lower version of HTML may be applied to it. The markup I supplied in the other thread (which you had the gaul to criticize) was also an incomplete page which did not indicate the version of HTML. So, have the decency (if you have any -- which I doubt you do) to apply the same standards to yourself as you apply to others. [/B]
[/QUOTE]
Wow, phpnovice, you are missing why I chriticized it in the first place. I did because you are using javascript incorrectly. In the other thread your script would have made the contents completely inaccessible for some of your users, in this thread your script would hace caused the form to fail for some of your users.

In my last post I was not supplying an html example, I was supplying a loop to show how to write out text boxes. The first part was just to show the neccessary parts of the form to select the number of rows. This code is no where near complete, it is just complete enough for this example. If it were not explicitly requested that these be table rows I would suggest using a more semantically correct element for layout out the form too.

If you still believe that I am wrong why don't you go ask some of the forum's other senior members to have a look see at the threads and be the judge. It seems to me that you just have a certain arrogance about you and cannot stand to have someone else pointing out things that need to be changed.

about that apply the standards remark: I adhear to the accessibility standards set by the w3c in the web content accessibility guidlines: http://www.w3.org/TR/WAI-WEBCONTENT/ , http://www.w3.org/TR/WCAG20/

and I comply with 508. I also [b]keep all neccessary scripting to website functionality on the server[/b]. As I have said countless times on this forum, javascript should only be used for [b]nonessential[/b] things, such as first stage form validation.
Copy linkTweet thisAlerts:
@phpnoviceJan 12.2005 — [i]Originally posted by PeOfEo [/i]

[B]you are missing why I chriticized it in the first place. I did because you are using javascript incorrectly.[/B][/QUOTE]

Bald-faced liar! The following is an exact quote of what you said in the other thread. You'll note that [b][u][i]ONLY[/i][/u][/b] the first bullet point has to do with a javascript-related usage that speaks to accessibility. [b][u][i]ALL[/i][/u][/b] of the other points have to do with the difference between versions of HTML. [b][u][i]YOU[/i][/u][/b] took it upon yourself to demand that the "example" HTML I provided had to be 4.01 Strict and passed judgement upon me on that basis.
[i]Originally posted by PeOfEo [/i]

[B]PHPnovice has done the following:

[list]
  • [*]Had objects set to display:none and this is altered with javascript, users without javascript cannot get the content

  • [*]there is not a doc type in sight in any of his examples. Without a doc type the browser is in quirks mode.

  • [*]inaccessible attribute for a list type="I", type is now deprecated and has been replaced by a css equiv

  • [*]lack of type tag for a style tag. The style tag is not reserved just for css so this leaves the browser guessing.

  • [*]lack of type tag for javascript, again the browser is guessing.

  • [/list]

    Those are just a few errors I would like to point out that exist in this thread alone. [/B][/QUOTE]

    By your own measuring stick, what you posted is just as invalid. That makes you a two-faced jerk for saying one thing but doing another. Naturally, ass-hole that you are, you will not admit that I am correct in this point. You will make your [url=http://dictionary.reference.com/search?q=asinine]asinine[/url] excuses. However, the facts speak for themselves.
    [i]Originally posted by PeOfEo [/i]

    [B]If you still believe that I am wrong why don't you go ask some of the forum's other senior members to have a look see at the threads and be the judge.[/B][/QUOTE]

    Well, I'll have you know that I don't have to ask. You think that I am new here just because I've only signed up recently. In actuality, I've been sitting on the sidelines watching these forums ever since they converted from the old system. Learned quite a bit, too. My mistake was in finally deciding to sign up so that I could get some PHP advice. I wish I had just found some other (nicer) site for my needs.

    But, I've also watched while ass-holes like you and Charles (just to name two) have continued to mistreat and criticize those who have come here for help. I also had to watch while some really good people left because of your misuse of your own supposed power.

    One of those people that left was Dave Clark. Mr Clark's only problem was that he couldn't stand ass-holes like you abusing people needlessly. The only people he ever passed judgement on were you jerks. Funny thing, though, in the beginning you were one of the nice guys. Too much influence from Charles (who was bad, bad from the start) has rotted your core.

    The biggest mistake this site ever made was to not stand up for its own rules by letting Charles continue to say the things he has said in the JavaScript forum. And, then, through its own stupidity, to let a JavaScript expert and master like Dave Clark just pick and leave. Hey, that forum is explicitly for JavaScript! Why continue to let an ass-hole parade about in there telling everybody how bad they are for using JavaScript? And, yes, that is exactly what he does (and you do).
    [i]Originally posted by PeOfEo [/i]

    [B]It seems to me that you just have a certain arrogance about you and cannot stand to have someone else pointing out things that need to be changed.[/B][/QUOTE]

    Uh-huh... The pot calling the kettle black.
    Copy linkTweet thisAlerts:
    @PeOfEoJan 12.2005 — Novice, just because you cannot take criticizm does not make us mean. You should not call others dirty names when you are using javascript in a way that excludes users from your websites. :rolleyes:

    You have been arguing with me through this whole thread, but the whole reason I originally cricized you in the other thread was because you made content inaccessible. The reason I ever questioned which method (orinally) in this thread you thought was better was because I thought you would realize that using javascript was going to fail for x number of users. But you did not, and when I point that you flew off the handle. Grow up and learn to take some criticizm.

    Also, it looks to me like you do not really know why daveclark was banned.

    I am going to say this once novice, keep a civil tongue. Keep calling members (like myself and charles) names and you too will be banned.
    Copy linkTweet thisAlerts:
    @phpnoviceJan 12.2005 — [i]Originally posted by PeOfEo [/i]

    [B]Also, it looks to me like you do not really know why daveclark was banned.[/B][/QUOTE]

    Shows how much you know (NOT!)... He wasn't banned. He left on his own -- and without even being asked to leave by the administration. Do you remember stealersfan? I watched enough going on here to figure out the basic details for myself. Any intelligent person who isn't stuck on himself could see what was as plain as your hand in front of your face at high noon on a completely clear day. However, stealersfan started posting things saying that he had talked to Mr. Clark, etc.

    So, I, too, went to talk to Mr. Clark and he confirmed what I already knew from just watching it unfold. I also saw him return under his original name just a few months ago (in the ASP forum). That is another proof that he wasn't banned. When he left, again, I spoke to him -- again. (I knew he left because his posts disappeared, again. I do not blame him for deleting his own posts. Noone who is as mistreated, as he was, would wish to leave their legacy behind -- quite possibly only to continue to receive undeserved criticism.) He told me, then, that he told Pete to go ahead and ban him. So, yes, [b]NOW[/b] he may be banned. But, again, it was by his own choice. And, again, I don't blame him one bit.

    I see, now, that the administrators have changed things to prevent people from deleting their own posts. (I know this because I tried to delete my post when Charles, true to his [url=http://dictionary.reference.com/search?q=asinine]asinine[/url] nature, just like yours, criticized my post when all I did was give the person the JavaScript for which they explicitly asked.) Pretty funny, that. ?
    [i]Originally posted by PeOfEo [/i]

    [B]I am going to say this once novice, keep a civil tongue. Keep calling members (like myself and charles) names and you too will be banned.[/B][/QUOTE]

    It doesn't really matter -- since those that deserve banning, aren't. Getting banned from a site, like this, is neither a disgrace nor a hardship.
    Copy linkTweet thisAlerts:
    @DaveSWJan 12.2005 — Guys, this forum is not a place for you to argue. If you wish to call each other names please do it in private.

    Clearly Server Side is a better solution than javascript because it works for more people. That's simple statistics. No arguments needed. On the other hand, you work with what technologies you have available.

    Please ensure any further posts are back on topic, or this thread will have to be closed, which hardly seems fair on the original poster.
    Copy linkTweet thisAlerts:
    @phpnoviceJan 12.2005 — [i]Originally posted by DaveSW [/i]

    [B]On the other hand, you work with what technologies you have available.[/B][/QUOTE]

    Exactly! Just one of the reasons I referred to in regard to why such criticism is unfounded and, hence, wrong. But do such criticizers bother to ask if server-side code is even an option? No, because they don't care. All they're interested in is the enjoyment of the criticism.
    [i]Originally posted by DaveSW [/i]

    [B]Please ensure any further posts are back on topic, or this thread will have to be closed, which hardly seems fair on the original poster.[/B][/QUOTE]

    Exactly! Such criticizers hijack posts at this site all the time, for their own aggrandizement, and are not censured for it. It is totally not fair to the person asking the original question. It is also totally not fair to the person that simply tries to answer the question asked -- [u]without[/u] assuming anything. This is the only thing such criticizers know how to do -- [COLOR=red]ass[/COLOR][COLOR=blue]u[/COLOR][COLOR=green]me[/COLOR] things.
    Copy linkTweet thisAlerts:
    @Khalid_AliJan 12.2005 — This is absured that one after another there are such threads where we have futile discussions on server side or no server side coding(which are both required in real life for their appropriate reasons).

    I won't jump in this useless discussion however I'd request all members to be nice and try not to be rude to each other or if you do want to do that then as dave said do it in private.

    The original posters question has been answered therefore please leave this thread alone now.

    Thanks.
    Copy linkTweet thisAlerts:
    @sanjuTauthorJan 12.2005 — [i]Originally posted by PeOfEo [/i]

    [B]Basically your select number page is pretty simple, it can just be a plain html page if you like. Here is some code

    <i>
    </i>&lt;body&gt;
    &lt;form action="yourform.asp" method="post"&gt;
    &lt;select name="number"&gt;
    &lt;option value="1"&gt;1&lt;/option&gt;
    &lt;option value="2"&gt;2&lt;/option&gt;
    &lt;option value="3"&gt;3&lt;/option&gt;
    &lt;option value="4"&gt;4&lt;/option&gt;
    &lt;option value="5"&gt;5&lt;/option&gt;
    &lt;option value="6"&gt;6&lt;/option&gt;
    &lt;/select&gt;
    &lt;input type="submit" value="Submit"/&gt;
    &lt;/form&gt;
    &lt;/body&gt;


    The form page would have to be asp
    <i>
    </i>&lt;body&gt;
    &lt;table&gt;
    &lt;%
    dim numrows
    numrows=Request.Form("number")
    dim i
    For i=1 to numrows
    %&gt;
    &lt;tr&gt;&lt;td&gt;&lt;input type="text" name="usernum&lt;% response.write(i) %&gt;" size="20"&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;%
    Next
    %&gt;
    &lt;/table&gt;
    &lt;/body&gt;

    If you notice the name is usernum1, 2, 3, and so on. I have the name incrimenting so you do not have duplicate feilds and have problems when you try to request that value.

    Now, if you want to use that number the user selected later you can at the top of the asp page drop that into the session temporarily or something to be used on this page and other pages. You can add up those form values client side to show the user, but It would be easy and safe to also do that server side when you process this form.

    You can see these nuggets of code in action on my server:

    http://quasi-ke.servebeer.com/sampleaps/selectnum.asp [/B][/QUOTE]


    THANKS Peofeo!!! I will give that a try. i have about 6 fields per row, so i will name each related field a similar name, but differentiated by a 1, 2, etc. at the end. i will post what i come up with.

    BTW, is it easier to do this server-side, or just that it is the correct way to do it? also, i get a connection time-out when trying to view the page u posted.
    Copy linkTweet thisAlerts:
    @DaveSWJan 12.2005 — Basically, some people have javascript disabled (last time I checked it was about 13%). So for those 13%, your page won't work properly if you do it with javascript.

    However, if you do this server side, regardless of what the user supports it will work.

    So Server Side is the best solution because it works for everyone. Javascript will work for most but not all, so do it server side if you can, client side if you can't.

    Does that sort of make sense?
    Copy linkTweet thisAlerts:
    @sanjuTauthorJan 12.2005 — ya, makes sense. i develop for an intranet, so i guess i don't have to worry about JS not being enabled (i know someone will sug. that i should do it server-side to get in the habit, i understand).
    Copy linkTweet thisAlerts:
    @Khalid_AliJan 12.2005 — [i]Originally posted by sanjuT [/i]

    [B]...so i will name each related field a similar name, but differentiated by a 1, 2, etc. at the end....[/B][/QUOTE]


    Actually you can name all the fields the same name and then retrieve all the values from the array of fields using your request object.I know in java its peice of cake just name the filed and get values such as

    String[] nameFieldValues = request.getParameterValues("usernum");

    and this will return a hole list of values for alll the elements and you don't have to worry about the number of fields. I am confident that ASP does have a similar mechanism for such tasks
    Copy linkTweet thisAlerts:
    @DaveSWJan 12.2005 — if you're on an intranet and you know that all the machines have javascript then you do whatever's easiest for you. Unless you might want to transfer it to the internet at a later date.
    Copy linkTweet thisAlerts:
    @PeOfEoJan 12.2005 — I posted a while ago that my posts and novices should be moved to the coffee lounge but no one took me up on that :rolleyes:

    I replied to phpnovice's posts in this new thread:

    http://www.webdeveloper.com/forum/showthread.php?s=&postid=300306#post300306
    Copy linkTweet thisAlerts:
    @PeOfEoJan 12.2005 — [i]Originally posted by sanjuT [/i]

    [B]THANKS Peofeo!!! I will give that a try. i have about 6 fields per row, so i will name each related field a similar name, but differentiated by a 1, 2, etc. at the end. i will post what i come up with.



    BTW, is it easier to do this server-side, or just that it is the correct way to do it? also, i get a connection time-out when trying to view the page u posted. [/B]
    [/QUOTE]
    The server that was running on is my pc, I use it as a testing box. I keep it on all night generally but I usually have it turned off when I am in class or at work. ?

    I consider server side to be just as easy. You are now talking about an intranet, so you can use either method safely unless, as dave said, you choose to put it on the internet one day. But I would not say running the script client side or server side would make it any more difficult. The whole issue was the fact that a good chunk of people do not support javascript so running this client side on the open internet would render your form useless for those people.
    Copy linkTweet thisAlerts:
    @sanjuTauthorJan 17.2005 — here is what i have so far (i know the CSS is not perfect, just rough right now):

    <i>
    </i>&lt;form name="yourform.asp"&gt;
    &lt;table&gt;
    &lt;%
    dim numrows
    numrows=Request.Form("number")
    dim i
    For i=1 to numrows
    %&gt;
    &lt;table title="Itemized List Entry" style="border-right:medium none;table-layout:fixed;border-top:medium none;font-size:10pt;border-left:medium none;width:545px;border-bottom:medium none;font-family:Verdana;border-collapse:collapse;word-wrap:break-word" border=1 width="606" ID="Table1"&gt;
    &lt;colgroup&gt; &lt;col style="width:45px" width=45&gt; &lt;col style="width:161px" width=161&gt;
    &lt;col style="width:102px" width=102&gt; &lt;col style="width:71px" width=71&gt; &lt;col style="width:73px" width=73&gt;
    &lt;col style="width:93px" width=93&gt;&lt;/colgroup&gt; &lt;tbody valign=top&gt;
    &lt;tr style="min-height:21px"&gt;
    &lt;td style="color:black;background-color:#ebf0f9;border-right:#517dbf 1pt solid;padding-right:3px;border-top:#000000 2pt solid;padding-left:3px;padding-bottom:3px;vertical-align:middle;border-left:#517dbf 1pt solid;padding-top:3px;border-bottom:#000000 1pt" rowspan=2 width=45&gt;
    &lt;div&gt;&lt;font face=Verdana size=1&gt;&lt;strong&gt;Item &lt;/strong&gt;&lt;/font&gt;&lt;font face=Verdana size=1&gt;&lt;strong&gt;#&lt;/strong&gt;&lt;%response.write(i)%&gt;&lt;/font&gt;&lt;/div&gt;
    &lt;/td&gt;
    &lt;td style="color:black;background-color:#ebf0f9;border-right:#517dbf 1pt solid;padding-right:3px;border-top:#000000 2pt solid;padding-left:3px;padding-bottom:3px;vertical-align:middle;border-left:#517dbf 1pt solid;padding-top:3px;border-bottom:#517dbf 1pt solid" colspan=4&gt;
    &lt;div&gt;&lt;font face=Verdana size=1&gt;&lt;strong&gt;Description: &lt;/strong&gt;&lt;input type="text" name="description&lt;%response.write(i)%&gt;" size="60"&gt;&lt;/font&gt;&lt;/div&gt;
    &lt;/td&gt;
    &lt;td style="color:black;background-color:#ebf0f9;border-right:#517dbf 1pt solid;padding-right:3px;border-top:#000000 2pt solid;padding-left:3px;padding-bottom:3px;vertical-align:middle;border-left:#517dbf 1pt solid;padding-top:3px;border-bottom:#000000 1pt" rowspan=2 width=101&gt;
    &lt;div align=center&gt;&lt;font face=Verdana size=1&gt;&lt;strong&gt;Total: &lt;/strong&gt;&lt;input type="text" name="total&lt;%response.write(i)%&gt;" size="5"&gt;&lt;/font&gt;&lt;/div&gt;
    &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr style="min-height:21px"&gt;
    &lt;td style="color:black;background-color:#ebf0f9;border-right:#517dbf 1pt solid;padding-right:3px;border-top:#517dbf 1pt solid;padding-left:3px;padding-bottom:3px;vertical-align:middle;border-left:#517dbf 1pt solid;padding-top:3px;border-bottom:#000000 1pt" width=177&gt;
    &lt;div&gt;&lt;font face=Verdana size=1&gt;&lt;strong&gt;Part Number: &lt;/strong&gt;&lt;input type="text" name="partno&lt;%response.write(i)%&gt;" size="10"&gt;&lt;/font&gt;&lt;/div&gt;
    &lt;/td&gt;
    &lt;td style="color:black;background-color:#ebf0f9;border-right:#517dbf 1pt solid;padding-right:3px;border-top:#517dbf 1pt solid;padding-left:3px;padding-bottom:3px;vertical-align:middle;border-left:#517dbf 1pt solid;padding-top:3px;border-bottom:#000000 1pt" width=110&gt;
    &lt;div&gt;&lt;font face=Verdana size=1&gt;&lt;strong&gt;Quantity: &lt;/strong&gt;&lt;input type="text" name="quantity&lt;%response.write(i)%&gt;" size="10"&gt;&lt;/font&gt;&lt;/div&gt;
    &lt;/td&gt;
    &lt;td style="color:black;background-color:#ebf0f9;border-right:#517dbf 1pt solid;padding-right:3px;border-top:#517dbf 1pt solid;padding-left:3px;padding-bottom:3px;vertical-align:middle;border-left:#517dbf 1pt solid;padding-top:3px;border-bottom:#000000 1pt" width=75&gt;
    &lt;div&gt;&lt;font face=Verdana size=1&gt;&lt;strong&gt;UOM: &lt;/strong&gt;&lt;input type="text" name="uom&lt;%response.write(i)%&gt;" size="5" ID="Text2"&gt;&lt;/font&gt;&lt;/div&gt;
    &lt;/td&gt;
    &lt;td style="color:black;background-color:#ebf0f9;border-right:#517dbf 1pt solid;padding-right:3px;border-top:#517dbf 1pt solid;padding-left:3px;padding-bottom:3px;vertical-align:middle;border-left:#517dbf 1pt solid;padding-top:3px;border-bottom:#000000 1pt" width=77&gt;
    &lt;div&gt;&lt;font face=Verdana size=1&gt;&lt;strong&gt;Unit Price: &lt;/strong&gt;&lt;input type="text" name="price&lt;%response.write(i)%&gt;" size="5" ID="Text1"&gt;&lt;/font&gt;&lt;/div&gt;
    &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;
    &lt;%
    Next
    %&gt;
    &lt;/table&gt;
    &lt;/form&gt;


    How can i get the totals, first for each item, then a grand total at the bottom?

    i thought i had the code, but the code i have uses predetermined values for price. in this case, i would not know the price before, it is entered by the user.

    i am wondering if i'll need to have a 'Calculate' button to trigger the total calculation, or if an 'onBlur()' or something similar might work.

    any advice would really help!!
    Copy linkTweet thisAlerts:
    @PeOfEoJan 17.2005 — Yes, you can probably just add the feilds up at the bottom as the user enters text with onblur (adding the previos element). Just so the user has an idea of the prices. But you are going to add the grand total up after the form is submitted too, just so this thing will run accuratly for everyone, but that is pretty straight forward.
    ×

    Success!

    Help @sanjuT spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.17,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...