Disable update post button after submit keeps the post as a draft - wordpress

I have a form in WordPress that has a dynamically generated text box so the user can enter multiple text boxes. This works fine but if the user presses the save/update button multiple times it is saving multiples of the same data from these generated text boxes.
I tried a JavaScript solution to disable the button once pressed which works, my data saves correctly from the generated text boxes but then if it is a new post only it ever saves as a draft.
Is there a solution?

Instead of using disable on the #publish button, .hide(); worked instead.

Related

#autocomplete_path trigger on focus in Drupal 7

I want to show some autocomplete option on focus, at the moment '#autocomplete_path' only works when a user types something in the text field.
How can we show some default suggestion moment user click inside the text field?
As I tried a lot using Drupal form API, not able to achieve. Now using JQuery/AJAX and showing dynamic option list onclick.

Visual indication for inline buttons

Is there a way to show some visual indication that the inline button has been pressed in telegram bot.
I have a bit which send inline keyboard, and when I press each buttons it works perfectly fine, but there is a slight delay in getting response from the server. As there is no visual indication to show if a button has been pressed, it is confusing for uses to know if the button was pressed and end up pressing the same button several times.
there are different types of inline buttons in Telegram:
Opens URL (with url).
Forward a message (with switch_inline_query).
Insert query at the chat (with switch_inline_query_current_chat).
Button with action (with callback_data).
I suppose you are refering to the last type of button, in that case, if a user press a button you will get the callback_data via CallbackQuery, and that lets you modify the original message with editMessageText to add something like:
Button TEST pressed.
As an alternative way, after you got the callback response at your server, you can use Emoji for showing feedback to your users. Just edit the inline message and edit some relative emoji to the button text.

wxPython issue in changing button text

I am working on a wxPython app where I have a button with label text 'Allocate'. Additionally I also have 2 radio options on my app namely 'UnAllocated' and 'Allocated'. When the app launches by default the radio option 'UnAllocated' is selected and the button has label text as 'Allocate'. I have made event driven code to change the label text of the button from 'Allocate' to 'Re-Allocate' upon selecting the radio option 'Allocated'. Uptill now everything is fine and code works as intended.
Now the problem is in the event of radio option 'Allocated' the button label does gets a new label text as 'Re-Allocate' however it is overwriting the previous label text instead of changing. Then as soon as I bring my mouse cursor on the button the text gets refreshed and appears clean and clear. Below is my Code
def rdoAllocated_Click(self, event):
self.btn_Allocate.SetLabelText('Re-Allocate')
def rdoUnAllocated_Click(self, event):
self.btn_Allocate.SetLabelText('Allocate')
is there a way of refreshing the button label text automatically after the change to display clearly the new text instead of unreadable overwritten text.
Here is the image how it looks when getting updated
Try calling self.btn_Allocate.Refresh() This can happen sometimes, depending on platform and widget types. The Refresh simply tells the system to send a paint event in the near future, and will most-likely take care of the problem for you. If not then you may need to call the parent window's Refresh instead.

How to get values of dynamic text boxes

How can i get the values of dynamically created text boxes that i have reload every time a user adds a new text box?
Right now what I have is a form with a few text boxes, and an add button, now when the a user clicks add button, it creates another section with a few more text boxes, but now if the user had typed something in one of the text boxes before he clicked add, how can i store that information and make sure it comes back up when the page reloads?
Thank you,

JqGrid ask for new fields on click custom button

I have added a custom button to the navigator in my jqgrid and i am wondering how can i ,when i click on the button, show a dialog with the same style as the edit dialog and ask for some especific fields that are not included in the colModel. Those field would be to be sent to the server when clicking on ok button.
Any ideas?
Thanks in advance.
Carlos.
You can display the "Edit" dialog using editGridRow method. In the second (properties) parameter of the method you can include your custom beforeShowForm event handler which can make any modifications in the dialog.
See last demo from the answer for an example. The demo has the line
$('<tr class="FormData" id="tr_AddInfo"><td class="CaptionTD ui-widget-content">'+
'<b>Additional Information:</b></td></tr>').insertAfter (nameColumnField);
inside of beforeShowForm.
If the information which you need to show in the dialog are from the hidden column of the grid you can use simplified way which you find here. The main idea in the solution is that jqGrid include in the form dialog all hidden fields, but the corresponding row is hidden. So it is enough just to show the hidden row.

Resources