CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> .NET

 Submit Record Form On Change of Listbox

Print topic Send  topic

Author Message
swilson


Posts: 84
Posted: 10/17/2005, 5:47 PM

I want On Change of Listbox1 in my Record Form to submit the update of the form to my database. i.e. perform the same funtion as the existing Submit button.

I tried the following:

1. Added the Action Submit Form to the Client On Change of the ListBox1.

Results: Selecting a new value in the listbox caused the page to reload, however my changes were not updated to the database. The new values were only updated when I pressed the submit button.

2. Undid the above and selected Add Code to the Client On Change of ListBox1. I tried this:
javascript:document.Record Aircraft.submit()
then when that didn't work I made it this:
javascript:document.Record Aircraft.submit();

Upon page load in the browser, I'd get the error: Expected ';' ...whether or not a ; was at the end of the line I added.

I read all the forum material and still can't figure out how to make the On Change submit my form as an Update to the db.

Thanks for your help! .net vb
_________________
It continues to amaze me, how often the solutions to seemingly complex problems are so very simple.
View profile  Send private message
BlinkyBill

Posts: 86
Posted: 10/18/2005, 1:52 AM

The most straight forward thing is: space between Record and Aircraft.
View profile  Send private message
Stan
Posted: 10/18/2005, 2:03 AM

Hi

ASP.NET has only one form on the page, named _ctl0. But you can't simple submit form, because server handler will not know which control caused submit. So you need emulate button click, by call in ListBox onchange event
document.all["UpdateButtonId"].click();

Stan
swilson


Posts: 84
Posted: 10/18/2005, 6:07 AM

Hi Stan,

Adding this line to the onclick add code of the listbox:
javascript:document.AircraftButton_Update.submit();
or
javascript:document.Button_Update.submit();

Resulted in this error in the broswer upon change:
Error: 'document.AircraftButton_Update' is null or not an object
or
Error: 'document.Button_Update' is null or not an object

I'm still not understanding. THANKS.

_________________
It continues to amaze me, how often the solutions to seemingly complex problems are so very simple.
View profile  Send private message
Tuong Do
Posted: 10/26/2005, 6:46 PM

Hi Swilson,

Doing this way always work for me


For example

Your Form Name : Employer
Your Update button Name: Button_Update


Then for the client onchange of the list box

document.forms["_ctl0"].EmployerButton_Update.click();


it will submit your form like you have just click on the update button



"swilson" <swilson@forum.codecharge> wrote in message
news:8435446139f2b0@news.codecharge.com...
>I want On Change of Listbox1 in my Record Form to submit the update of the
>form
> to my database. i.e. perform the same funtion as the existing Submit
> button.
>
> I tried the following:
>
> 1. Added the Action Submit Form to the Client On Change of the ListBox1.
>
> Results: Selecting a new value in the listbox caused the page to reload,
> however my changes were not updated to the database. The new values were
> only
> updated when I pressed the submit button.
>
> 2. Undid the above and selected Add Code to the Client On Change of
> ListBox1.
> I tried this:
> javascript:document.Record Aircraft.submit()
> then when that didn't work I made it this:
> javascript:document.Record Aircraft.submit();
>
> Upon page load in the browser, I'd get the error: Expected ';' ...whether
> or
> not a ; was at the end of the line I added.
>
> I read all the forum material and still can't figure out how to make the
> On
> Change submit my form as an Update to the db.
>
> Thanks for your help! .net vb
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

swilson


Posts: 84
Posted: 10/26/2005, 7:15 PM

Tuong Do,

It worked for me too. Thanks for helping me.

Steve
_________________
It continues to amaze me, how often the solutions to seemingly complex problems are so very simple.
View profile  Send private message
swilson


Posts: 84
Posted: 10/27/2005, 3:14 PM

Is there a way to submit the form in this same manner, yet hide the button?

There's no need to have a button in a situation where the only control on the form is one listbox.
_________________
It continues to amaze me, how often the solutions to seemingly complex problems are so very simple.
View profile  Send private message
Tuong Do
Posted: 10/27/2005, 11:34 PM

Hi Swilson,

In the client on load event of your form add the jave script to hide the
button
document.getElementById('EmployerButton_Update').style.visibility =
"hidden";

and then in the client onchange event of the list box add the below java
script to temporary unhide & then click the button

document.getElementById('EmployerButton_Update').style.visibility =
"visible";
document.forms["_ctl0"].EmployerButton_Update.click();
document.getElementById('EmployerButton_Update').style.visibility =
"hidden";




"swilson" <swilson@forum.codecharge> wrote in message
news:8435446139f2b0@news.codecharge.com...
>I want On Change of Listbox1 in my Record Form to submit the update of the
>form
> to my database. i.e. perform the same funtion as the existing Submit
> button.
>
> I tried the following:
>
> 1. Added the Action Submit Form to the Client On Change of the ListBox1.
>
> Results: Selecting a new value in the listbox caused the page to reload,
> however my changes were not updated to the database. The new values were
> only
> updated when I pressed the submit button.
>
> 2. Undid the above and selected Add Code to the Client On Change of
> ListBox1.
> I tried this:
> javascript:document.Record Aircraft.submit()
> then when that didn't work I made it this:
> javascript:document.Record Aircraft.submit();
>
> Upon page load in the browser, I'd get the error: Expected ';' ...whether
> or
> not a ; was at the end of the line I added.
>
> I read all the forum material and still can't figure out how to make the
> On
> Change submit my form as an Update to the db.
>
> Thanks for your help! .net vb
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

swilson


Posts: 84
Posted: 10/28/2005, 6:41 PM

Thank you again.
_________________
It continues to amaze me, how often the solutions to seemingly complex problems are so very simple.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.