/    Sign up×
Community /Pin to ProfileBookmark

Order Invoice

I am creating an order invoice utilizing PHP/MYSQL and Javascript

I have it setup in Javascript to dynamically add more text fields (Item#) as more items need to be ordered. Additionally, I have it set up to perform an onchange where it gets a PHP file and reads the database, depending upon the values returned, it displays a message. I am currently returning my message in a <div> statement. The formatting has been getting me as I can’t figure out how to drop the <div> query return beside the corresponding javascript created text input field, I can only get it to go below the field and if I add an additional field, it stays below the last added field.

[CODE]
<script language=”javascript”>
row_no=0;
function addRow(tbl,row){
row_no++;
if (row_no<=5){
if (row_no==5){
var textbox* = row_no+’. &nbsp <input type=”text” size = “12” name= item_no[] onchange=showUser5(this.value)>’;}
if (row_no==4){
var textbox* = row_no+’. &nbsp <input type=”text” size = “12” name= item_no[] onchange=showUser4(this.value)>’;}
if (row_no==3){
var textbox* = row_no+’. &nbsp <input type=”text” size = “12” name= item_no[] onchange=showUser3(this.value)>’;}
if (row_no==2){
var textbox* = row_no+’. &nbsp <input type=”text” size = “12” name= item_no[] onchange=showUser2(this.value)>’;}
if (row_no==1){
var textbox* = row_no+’. &nbsp <input type=”text” size = “12” name= item_no[] onchange=showUser1(this.value)>’;}
var tbl = document.getElementById(tbl);
var rowIndex = document.getElementById(row).value;
var newRow = tbl.insertRow(row_no);
var newCell = newRow.insertCell(0);
newCell.innerHTML = textbox;
if (row_no>5){
alert (“Too Many Items. Limit of 5.”);
}
}
}
</script>

<form>
<table width=”1000″ border=”0″ cellspacing=”0″ cellpadding=”2″ id=”table1″>
<th>Item #</th>
<th>Item Description</th>
</left>
<tr id=”row1″>
<td>
<div style=”float:left” id=”txtHint1″></div>
<td>
<td>
<div style=”float:left” id=”txtHint2″></div>
<td>
<td>
<div style=”float:left” id=”txtHint3″></div>
<td>
<td>
<div style=”float:left” id=”txtHint4″></div>
<td>
<td>
<div style=”float:left” id=”txtHint5″></div>
<td>
</tr>
<tr>
<td>
<input type=”button” name=”Button” value=”Add Item to Order” onClick=”addRow(‘table1′,’row1’)”>
</td>
</tr>
<tr>
<td>
<input type=”submit” value=”Add Order”>
</td>
</tr>
</form>
[/CODE]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@FangAug 26.2010 — Is the returned value the Item Description?

The table is incorrectly formatted to begin with; number of cells/row

Start with an input field, then clone the row when a new input is required.
×

Success!

Help @monion 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.19,
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,
)...