Must hit submit twice.
| Project: | Chatblock |
| Version: | 5.x-1.0.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | dwees |
| Status: | postponed (maintainer needs more info) |
Jump to:
Hi Dave,
"I have this module installed on my site and I have been receiving complaints that one must push submit twice before the post appears. I have also added this and modified it for my design so that a lightbox opens with the text field, and before one can post they must hit submit, close the lightbox, re-open it, then hit submit and it posts. This also occurs with it just on the page as-well (so it's not a light-box specific problem.)"
I've narrowed it down to what I believe is going on, but I'm gonna need your help to solve the last bit :P
Basically, I've taken the chatblock mod and styled it severely with css to make it look the way I want, I also decided to (for more control over the text field) hide the original submit form (red striped), copy the form code (txt box, submit button, etc.. ), stick it in a seperate div (green), and have it open in a lightbox.
Color Coded Screenshot:
http://www3.telus.net/jong3/My%20Biography%20%7c%20Michael%20Boston%20Da...
Anyhow, at first I thought it was the lightbox interfering with some of the chatblock code, so I ran a test. I set the hidden div (green) that had the copied text box and submit button (green) (which opened in the lightbox) to display: block (from before being display: hidden so it would open in the lightbox) which showed the text field on the page.
I tried typing something into it, and submitting, the exact same problem. Usually, to submit it (if it were inside the lightbox) I'd have to close the lightbox, re open it, and then submit it again, well since it wasn't in anything to close, I couldn't find out if it would have submitted on the second time as just a regular div, but I'm positive it would have. At that point though, I knew it wasn't the lightbox causing the issues. Next, I unhid the original chatblock textbox, form, and components (striped red), and typed something, submit it, worked perfectly every time.
My suspicions are that the copied text box is interfering with the original one perhaps, and thinking that it can only submit every other time because perhaps it's confusing code?
I really need a way to solve this please, any help is appreciated.
Below is also a screencast of the (green) lightbox problem in action.
Screencast:
http://www.screencast.com/users/JonGirard/folders/Jing/media/c690570b-4e...
Thanks very much,
Jon.

#1
Sorry, here is the correct link for the color coded screen shot.
http://www3.telus.net/jong3/chat_problem.png
#2
Many people have noticed that this occurs with the Lightbox script. Not sure what is going on at all since I've never tried this modification.
What would more useful is access to the JavaScript error messages themselves (which you can access using the Firebug plugin for Firefox) or access to the page you have modified. I'm not such a JS guru that I can debug without more information. :)
Dave
#3
Hmm, yes it does occur with the lightbox script, even though my lightbox I was using is no longer active (facebox) because I upgraded my jquery install.. It also occurs with it just as a regular div on the page (as mentioned above.)
Oddly enough, there are no errors in firebug or the console.
If you wish, I could send you a version of the site for you to play around with on a local host, or give you access to the online site for your debugging purposes.
Thanks.
Jon.
#4
Either is fine, unfortunately I am going on holiday for a month so I won't be able to look at this until then.
Dave
#5
Not a problem, have a nice holiday. I'll send you an email with the files/ or details of where to login online and the password.
Thanks in advance for your help.
Jon Girard.
#6
I need more information in order to be able to clear up this issue. My guess is that if you want to use Lightbox to submit the messages, then you will have to modify the JS appropriately. Maybe the Lightbox textfield and submit buttons need a different ID attribute and some JS needs to be implemented so that the Lightbox is interacting better with the Chatblock.js?
Just a guess, marking this as 'needs more info'.
#7
Okay so I am revisiting the issues here and I think the problem is the duplicate ID's created by having more than 1 copy of a form on the page at a time.
The solution will be as follows, when I get a chance to implement it.
Instead of searching for an ID, I can search for a class, and when I find the appropriate class, grab that textfield's information. Then duplicate ID's won't confuse the box. However what will happen here is that only the first such textfield found will have its content stripped, but this does make it easier for developers wanting to modify the script, because you can easily change the class of your other form element (making sure it is used uniquely, only for that textfield) and then modify the JS to suit.
Does this solution make sense?