|
![Picture of Tarak Blah Picture of Tarak Blah](/graphics/unknown.gif) Tarak Blah - 2007-01-06 21:37:20
Hello,
I tried to use the usual "this.form.submit()"-javascript on the ONCHANGE-element of a select-input and failed. Here is the code I used:
$itemdisplay->AddInput(array(
"TYPE" => "select",
"ID" => "Colour",
"NAME" => "Colour",
"CLASS" => "FormColour",
"VALUE" => $colourvalue[0],
"SIZE" => 1,
"MULTIPLE" => 0,
"OPTIONS" => $colouroptions,
"ONCHANGE" => "this.form.submit();"
)
);
The reason why I want to do this is to log what colour of an item the customer of an online-shop wants to see and therefor automatically send a request to the webserver to display the wanted item. As you can figure out I failed. I also tried other things linke adding a javascript-function to the form, it didn't work, so before i put an efford on this I rather ask around: Does anyone have a suggestion how to realize this?
![Picture of Manuel Lemos Picture of Manuel Lemos](/picture/user/1.jpg) Manuel Lemos - 2007-01-06 22:35:20 - In reply to message 1 from Tarak Blah
I tried that on the MULTIPLE SELECT input of the test_form.php example, and it worked well as expected. It does not perform browser side validation, but the form is submitted.
If you wanted to perform validation, you can use the Connect function and connect the select input to a submit input to emulate the button click event.
Take a look at the test_linked_select.php script to see an example of usage of the Connect function.
![Picture of Tarak Blah Picture of Tarak Blah](/graphics/unknown.gif) Tarak Blah - 2007-01-06 23:11:33 - In reply to message 1 from Tarak Blah
Thanx,
this is what I did:
$itemdisplay->Connect("Colours", "submit", "ONCHANGE", "Click", array());
The second parameter "submit" is the submit-button's name....
Another "RTFM".
Incredibly fast reply, though...
Thank you very much. Also for your whole work...
Tarak
![Picture of Manuel Lemos Picture of Manuel Lemos](/picture/user/1.jpg) Manuel Lemos - 2007-01-06 23:51:32 - In reply to message 3 from Tarak Blah
Note that in your case, according to your input definition above, the first parameter should be "Colour" and not "Colours".
![Picture of Tarak Blah Picture of Tarak Blah](/graphics/unknown.gif) Tarak Blah - 2007-01-07 00:08:55 - In reply to message 1 from Tarak Blah
You're right. Just a TYPO...
T.
|