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. |
|
|
BlinkyBill
Posts: 86
|
Posted: 10/18/2005, 1:52 AM |
|
The most straight forward thing is: space between Record and Aircraft.
|
|
|
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. |
|
|
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. |
|
|
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. |
|
|
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. |
|
|