473,750 Members | 2,470 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need Help with my script logic

Hi.

In my script the below code creates a new element
on the page with an associated delete button:

var row_element = new Element(
'div',
{
'class':'contai ner',
'events':{
'click':functio n( uid ){
this.activeRow( uid );
}.pass( current_element .uid, this )
}
}
).adopt( delete_button ).adopt( item );

Now, when a user clicks on that element, I want the
input fields on the page to be particular to that element.
So, whatever is written in them, gets stored in an array
that is specific to this particular element "uid". If something
was written, the fields get repopulated when the element
is clicked on again.

Here is the function that gets activated when the element is clicked
on:

activeRow:funct ion( uid ){

active_row = this.elements[ this.uid_lookup[ uid ] ];
[?]

}

I am not quite sure how to approach this, help appreciated.

Thanks.

Sep 24 '07 #1
4 1324
On Sep 24, 2:36 pm, pbd22 <dush...@gmail. comwrote:
Hi.

In my script the below code creates a new element
on the page with an associated delete button:

var row_element = new Element(
'div',
{
'class':'contai ner',
'events':{
'click':functio n( uid ){
this.activeRow( uid );
}.pass( current_element .uid, this )
}
}
).adopt( delete_button ).adopt( item );

Now, when a user clicks on that element, I want the
input fields on the page to be particular to that element.
So, whatever is written in them, gets stored in an array
that is specific to this particular element "uid". If something
was written, the fields get repopulated when the element
is clicked on again.

Here is the function that gets activated when the element is clicked
on:

activeRow:funct ion( uid ){

active_row = this.elements[ this.uid_lookup[ uid ] ];
[?]

}

I am not quite sure how to approach this, help appreciated.

Thanks.
OK, I think I have figured out a more productive way to ask this
question (i hope). Could somebody show me how I could identify a
change on my form (select box, input field, textarea, etc) and assign
the new values to an associated array for each element. So, there will
be a selectbox[0], input[0], etc and selectbox[1], input[1], etc. My
attempts at this have been pretty ugly - lots of code.

Thanks for any help.

Sep 25 '07 #2
pbd22 wrote:
>
OK, I think I have figured out a more productive way to ask this
question (i hope). Could somebody show me how I could identify a
change on my form (select box, input field, textarea, etc) and assign
the new values to an associated array for each element. So, there will
be a selectbox[0], input[0], etc and selectbox[1], input[1], etc. My
attempts at this have been pretty ugly - lots of code.

Thanks for any help.
Well, if it works, does it matter if it's one or three lines of code? It
really shouldn't, especially if it makes for readable/maintainable code.

Maybe you should post the code that does work, so someone can help you
beautify/optimize it.
--
Sabine Dinis Blochberger

Op3racional
www.op3racional.eu
Sep 25 '07 #3
On Sep 24, 10:36 pm, pbd22 <dush...@gmail. comwrote:
In my script the below code creates a new element
The code below uses what must be a function named "Element" to create
a javascript object, though the fate of that object is unclear form
the code. If here you are referring to a DOM node implementing the
Element interface being created as a side effect (or anything else)
there is no evidence of that happening in this code.
on the page with an associated delete button:

var row_element = new Element(
'div',
{
'class':'contai ner',
'events':{
'click':functio n( uid ){
this.activeRow( uid );
}.pass( current_element .uid, this )
}
}
).adopt( delete_button ).adopt( item );

Now, when a user clicks on that element,
Which element? You can "click on" (at least most) DOM Elements, but
"clicking" is a little detached from being something that you can do
with a javascript object.
I want the input fields on the page
What input fields, what page?
to be particular to that element.
So, whatever is written in them, gets stored in an array
that is specific to this particular element "uid". If something
was written, the fields get repopulated when the element
is clicked on again.
That sounds more like you want the contents of an INPUT (presumably
type="text") Element to change when some notion of 'current selection'
is applied to one of some group of other Elements by the action of
clicking.
Here is the function that gets activated when the element is clicked
on:

activeRow:funct ion( uid ){

active_row = this.elements[ this.uid_lookup[ uid ] ];
[?]

}
How does it "get activated"? As javascript determines the - this -
value by how a function is called that is very important in
determining how this might behave, or be written so that it does
something related to what you are interested in.
I am not quite sure how to approach this, help appreciated.
The best approach to getting a question answered is to provide the
information necessary to answer it (and not hide it in anything
superfluous). Here you have provided none of the mark-up with which
this code is going to interact, you have not shown the context in
which the first code snippet is executed, your have not shown the
context in which the second is defined, you have not provided the
definition of the - Element - constructor used here, the - adopt -
method or the constructed/returned object (or the - adopt - method of
the object returned from the first call to - adopt -(if they differ)),
the - pass - method that appears to have been added to the -
Function.protot ype -, or any of the code that these may depend upon.
There is no indication of the type or nature of the - uid - value or
the - current_element - value.

Sep 25 '07 #4
On Sep 25, 9:47 am, Henry <rcornf...@rain drop.co.ukwrote :
On Sep 25, 2:01 pm, pbd22 wrote:On Sep 25, 4:03 am, pbd22 wrote:
<snip>
Henry, in response to your comments about not having enough
info. Below is the complete script (minus the delete function).

<snip>
You have omitted any code for the constructors - Class - and - Element
below is the script for construction:

<script type="text/javascript">
window.addEvent ('domready', function() {
new MultiUpload( $
( 'uploadForm' ).my_file_input _element, 0, '{id}', true, true );
});
</script>
-, their method definitions, some functions (the unwisely named - $ -
and - $defined - functions), at least two - Function.protot ype -
extensions, and the code that any of this absent code depends upon,
I am using a javascript library for this. I have no actual prototype
declarations of my own. For the library function definitions, you will
need to look at: http://docs.mootools.net
context of how the code you have posted is executed/used.
Please see the steps marked by an "x" earlier in the thread. The
larger picture is that this is a file upload form and that I am trying
to upload multiple files at the same time using the code I have
posted. The files will all then be sent to the server in succession
for processing. Where I am getting stuck is that, for each file, the
data associated with its form elements need to be saved prior to
submit. I am working on the solution in the activeRow:funct ion() block
that I have posted.
the mark-up that this code is intend to interact with and any
the hidden inputs get populated after the following on the form:

<input id="my_file_inp ut_element" type="file" name="file_1" />

the other relevant fields are pretty much everything that takes data
on the form - selects, inputs, textarea, radiobuttons, etc.

Rather than dump a ton of HTML here - I have named every relevant form
element name="ff1", name="ff2", name="ff3"... name=ffn", where "n" is
the count of the final element. This way I can loop through them if
need be.

Sep 25 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
10306
by: nc | last post by:
My iterator can find my collection when my Action class calls my jsp directly, however when my Action class calls an html file that is set up with IFrames (one of which is loading that same jsp), I get a servlet error "cannot find collection". Not usre if my issue is HTML, JSP, WebSphere or ??? Any help is very much appreciated. HTML file: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
1759
by: Matt | last post by:
I know we can write ASP with VB Script. Some people told me the big ASP projects usually use Visual Basic for the business logic. Is that the case? What I mean is an ASP project is the combination of server-side ASP code and Visual Basic components (.cls) Please advise. thanks!!
8
4230
by: Johnny Knoxville | last post by:
I've added a favicon to my site (http://lazyape.filetap.com/) which works fine if you add the site to favourites the normal way, but I have some JavaScript code on a couple of pages with a link, which when you click it bookmarks the site (much easier). The favicon is never saved if the site is bookmarked this way. Does anyone have any ideas how to fix this?? This is the code: <script language="JavaScript">
8
4672
by: Tom | last post by:
Please help. I need a quick little scrpit to place on a web page that will count how many days have passed since January 1, 1970. I have ZERO experience writing ANY scripts. Anyone have any suggestions? As for what is displayed on the screen, I just want it to say: Today is: 12578 (or however many days have passed since that date.)
1
1465
by: D. Shane Fowlkes | last post by:
I'm a fairly skilled traditional ASP/VB programmer and am learning .NET. I was (recently) surprised to read in a book about declaring and defining all my page Functions in <script runat="server"></script> tags and these tags "should" be after the <html> tag but before the <body> tag. I'm used to writing all of my "logic" including functions, in block delimiter tags such as <% %> above the <html> tag. So, is my method now "old school"...
4
3509
by: Bob T | last post by:
Hi All, I am trying to pass a variable from my VB asp.net script (from for example Sub Page_Load in mypage.aspx.vb) to my Client side script. I have found and looked at a very good example "Client and Server Scripting in Web Pages" but it only shows server side scripting that is written in HTML in mypage.aspx and not script from mypage.aspx.vb. How can I pass a variable value from mypage.aspx.vp to my client side script?
3
2453
by: Mike | last post by:
Hi, I am trying to resize a HTML table through Javascript. When the user control loads the first time, the table is resized, but then it doesn't anymore. I am using the following code in the Load event of the web user control: if ( ) this.Page.RegisterStartupScript("CallBothGrids", "<script language=javascript> { showBothGrids(); }</script>"); else
2
2028
by: ern | last post by:
My command-line application must be able to run text scripts (macros). The scripts have commands, comments, and flags. Comments are ignored (maybe they are any line beginning with " ; ") Commands are executed as if the user *manually* typed them in the console. Flags are special commands that tell the program where to BREAK, LOOP, START. A typical script may look like this: ; This is my script. It will test my mp3 player... START:
1
1467
by: jonathan184 | last post by:
how to monitor and find out if files test1_* and test2_* files were sent in an hour and if not send an email This is on a unix system basically I got a cronjob that runs every sec polling a ftp dir which name dir1 and transfers the file to another server So there are two types of files i want to check if are coming through and if they did not come through in an hour send an email. so files test1_* and test2_* I am checking for. Could...
0
9002
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9584
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9399
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9345
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8266
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6083
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4895
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3328
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.