Hi all,
I've got a form that consists of a bunch of textboxes and also file
upload inputs. For both sets of fields, I need to be able to add in
additional elements on the fly. This is done by an "Add Textbox" and
"Add Upload Fields" button that I use Javascript to add to the fields.
I use client-side Javascript only to add to the fields.
The problem comes when I submit the form. When I submit the form, the
files uploaded present no problems when I use Request.Files. But no
matter what, I can't seem to access the additional textboxes created
by Javascript from my server code. I have tried using FindControl and
Request.Form but both do not work.
One workaround I can think of is to use server-side code to add the
elements by doing a Postback everytime I click on the "Add Textbox"
button, but that would invariably involved uploading the files
selected in the File Upload fields which I want to prevent.
Does anybody know of a better way to do this?
Thanks
Wong 3 2135
Wong,
Have you included the additional textboxes in children property of any of
form controls? They need to belong to form's object hierarchy.
Alternatively, you can prepare all textboxes in advance and just hide/show
them as needed.
Eliyahu
"IRAS Blues" <li*****@yahoo. com> wrote in message
news:d8******** *************** ***@posting.goo gle.com... Hi all,
I've got a form that consists of a bunch of textboxes and also file upload inputs. For both sets of fields, I need to be able to add in additional elements on the fly. This is done by an "Add Textbox" and "Add Upload Fields" button that I use Javascript to add to the fields. I use client-side Javascript only to add to the fields.
The problem comes when I submit the form. When I submit the form, the files uploaded present no problems when I use Request.Files. But no matter what, I can't seem to access the additional textboxes created by Javascript from my server code. I have tried using FindControl and Request.Form but both do not work.
One workaround I can think of is to use server-side code to add the elements by doing a Postback everytime I click on the "Add Textbox" button, but that would invariably involved uploading the files selected in the File Upload fields which I want to prevent.
Does anybody know of a better way to do this?
Thanks Wong
These elements are inside Web User Control object which is called from
the default form in the web application I'm building. So the hierarchy
is sort of like this:
<form id="defaultForm "> -> <wuc id="defaultUplo adForm"> -> <table
id="upLoadTable "> -> <table id="Part_Table" > -> <input
id="Part_Num_*" >
Note that the * in Part_Num_* denotes whatever number is generated
when I click on the Add Part button.
using "this.FindContr ol" in the code behind page for
defaultUploadFo rm, I seem to be able to call upLoadTable & Part_Table
but I CANNOT seem to access anything inside it, including just any of
its rows e.g. this.upLoadTabl e.Rows[0].Cells[0].InnerHtml.ToSt ring().
All of them give an object reference error.
What can I be doing wrong here?
Thank you very much...
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message news:<O4******* *******@TK2MSFT NGP10.phx.gbl>. .. Wong,
Have you included the additional textboxes in children property of any of form controls? They need to belong to form's object hierarchy. Alternatively, you can prepare all textboxes in advance and just hide/show them as needed.
Eliyahu
"IRAS Blues" <li*****@yahoo. com> wrote in message news:d8******** *************** ***@posting.goo gle.com... Hi all,
I've got a form that consists of a bunch of textboxes and also file upload inputs. For both sets of fields, I need to be able to add in additional elements on the fly. This is done by an "Add Textbox" and "Add Upload Fields" button that I use Javascript to add to the fields. I use client-side Javascript only to add to the fields.
The problem comes when I submit the form. When I submit the form, the files uploaded present no problems when I use Request.Files. But no matter what, I can't seem to access the additional textboxes created by Javascript from my server code. I have tried using FindControl and Request.Form but both do not work.
One workaround I can think of is to use server-side code to add the elements by doing a Postback everytime I click on the "Add Textbox" button, but that would invariably involved uploading the files selected in the File Upload fields which I want to prevent.
Does anybody know of a better way to do this?
Thanks Wong
"I have tried using FindControl and Request.Form but both do not work."
FindControl:
remember that server-side code is only aware of page content (eg. elements)
that are either created during the initial request or subsequent postback.
So your server-side code will not be aware of any client-side added elements
(eg. <input> tags). Hence, "this.FindContr ol" will fail to see your new
textboxes.
Request.Form:
Your example indicated an "ID" attribute on the new <input> tag, but did not
include a "name" attribute. If memory serves, the "name" attribute must be
included for an <input> value to be submitted with a form. Further, the
following is quoted from the MSDN library regarding the "name" attribute:
==> The NAME attribute cannot be set at run time on elements dynamically
==> created with the createElement method. To create an element with a
==> name attribute, include the attribute and value when using the
createElement method.
hence the following Javascript should work:
var newTextbox = document.create Element('<input type="text"
name="part_num_ 11">') ;
[appropriate cell from part_table].appendChild(ne wTextbox) ;
Hope this helps.
"IRAS Blues" wrote: These elements are inside Web User Control object which is called from the default form in the web application I'm building. So the hierarchy is sort of like this:
<form id="defaultForm "> -> <wuc id="defaultUplo adForm"> -> <table id="upLoadTable "> -> <table id="Part_Table" > -> <input id="Part_Num_*" >
Note that the * in Part_Num_* denotes whatever number is generated when I click on the Add Part button.
using "this.FindContr ol" in the code behind page for defaultUploadFo rm, I seem to be able to call upLoadTable & Part_Table but I CANNOT seem to access anything inside it, including just any of its rows e.g. this.upLoadTabl e.Rows[0].Cells[0].InnerHtml.ToSt ring(). All of them give an object reference error.
What can I be doing wrong here?
Thank you very much...
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message news:<O4******* *******@TK2MSFT NGP10.phx.gbl>. .. Wong,
Have you included the additional textboxes in children property of any of form controls? They need to belong to form's object hierarchy. Alternatively, you can prepare all textboxes in advance and just hide/show them as needed.
Eliyahu
"IRAS Blues" <li*****@yahoo. com> wrote in message news:d8******** *************** ***@posting.goo gle.com... Hi all,
I've got a form that consists of a bunch of textboxes and also file upload inputs. For both sets of fields, I need to be able to add in additional elements on the fly. This is done by an "Add Textbox" and "Add Upload Fields" button that I use Javascript to add to the fields. I use client-side Javascript only to add to the fields.
The problem comes when I submit the form. When I submit the form, the files uploaded present no problems when I use Request.Files. But no matter what, I can't seem to access the additional textboxes created by Javascript from my server code. I have tried using FindControl and Request.Form but both do not work.
One workaround I can think of is to use server-side code to add the elements by doing a Postback everytime I click on the "Add Textbox" button, but that would invariably involved uploading the files selected in the File Upload fields which I want to prevent.
Does anybody know of a better way to do this?
Thanks Wong This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: J.R |
last post by:
Greetings,
I'm adding dynamically created input type='file' controls via JavaScript.
However when I try to access they do not seem to be returned in the form
collection. Any ideas?
Thanks, John.
|
by: hsomob1999 |
last post by:
so i have a <ul> and I allow the user to append items to it. The
problem is that on mozilla the <span class="line"> which is just a line
to divide the sections
gets overlaped and doesnt move down and adjust to the newly added items
like it does in iE. It just occured to me that i dont really have to
use a span, and a html <hr> tag could do the trick -I will go try. But
aside from that could some one explain why this occurs? And will I get...
|
by: JavaScriptRocks |
last post by:
I've been trying to imitate / reverse engineer the add attachment
feature in gmail composer. I managed to do it to say about 80% but its
giving me trouble in IE on WinXP-Sp2. I am using PHP to do the upload.
It works well on Firefox/DeerPark, but in IE, the file selected just
vanishes. You can verify it by commenting the lines marked "//IE
Trouble". Commenting those lines will remove IE specific code, except
the el.click() whick sends the...
|
by: drdave |
last post by:
Hi,
I have 6 forms being generated using coldFusion, they are named
special1, special2 special3 and so on.. in these forms I have a link to
open a new window.
I am trying to pickup the formname passed along to the new window.. the
window opener function is:
<SCRIPT LANGUAGE = "JavaScript">
|
by: devine |
last post by:
Hi All,
I have a form which checks which Submit button has been pressed and also shows a textarea dependant on an option selected.
The problem I have is that when I include my "display text" code, all submit buttons appear to be disabled.
However, when the "display text" is removed, the buttons function correctly.
<%@ LANGUAGE="VBSCRIPT" %>
<%response.buffer=true%>
<script language="javascript">
| |
by: RahimAsif |
last post by:
I am writing an application that requires the a portion of the main
menu to be dynamic. The menu has file, panels, view files and help
across the top. The view files sub menu needs to be dynamically
generated, and the dynamic generation needs to occur right when the
user selects this menu item (that is on the Popup event handler).
However, everytime I put following code on the Popup event handler (of
the View Files menuitem) to dynamically...
|
by: matt |
last post by:
hello,
i am on an interesting project. in this project, i have to create
dynamic data-entry forms for offline-users to fill out, save locally,
and eventually postback to our app (when back online). data validation
is required on the form.
i had looked at using PDF-forms for this.. Adobe's "LifeCyle Forms"
would work perfectly. with it one can pass in xml to their webservice &
get back PDF-form binaries. however, Adobe's pricing is...
|
by: redoranda |
last post by:
hi im a new user here. apparently im working on a project that is creating a dynamic form. Assume user can insert the data into text field and upload csv file, csv file may have two columns. user has to provide a special character like <> in text field to replace with data from second column of csv file.
here is the tmpl code:
<tr>
<td align="right">
BroadCast box:</td><td align="left"> <textarea name="mseg" rows="5" cols="33"...
|
by: phub11 |
last post by:
Hi all,
This was originally posted on the HTML section, but it was suggested that I post it in the JavaScript section, so here it is...
I have a file upload box contained within a form which I use to dynamically update the contents of a drop down.
I have a second form just below which I use to submit the same file as used in form 1. However, I have set things up so that the uploaded file is deleted after the drop down has been updated -...
|
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...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |