I have a page that contains a check box collection, an associated label on the left side, and an Iframe division on the right side.
When the check box division (including label) is clicked, the corresponding page is loaded in Iframe. Also, when clicking on another text check box didvision the page values in the current page should be saved and new page should be loaded in IFrame.
I accomplish this by calling the Javascript function of the Iframe page from parent page which, in turn, does a postback and triggers the save loic inide the event (For eg: I have a button inside each page which is hidden but has an event).
My problem is that when the check box is unchecked, the form displayed on the IFrame is cleared and disabled. So, when I click on some other division the postback of the current disabled form is executed and, since the entire form is disabled, there is no postbacking happening.
How could I trigger Postback for the disabled form or save the data another way?
Note: I even tried enabling the page before calling postback, but it still isn't triggering.
I would try to replace your iframes structure with dynamic sections controlled by Ajax. If this isn't feasible, rethink your disabling of the form. If the reason you're doing this is to prevent posting values twice, maybe instead of disabling the form, hide the button instead.
Related
I have a page with few forms in it and a submit button to save the records. If there is any errors then I m displaying the error messages programmatically in faces message .
But after clicking on the ok button on the af message, the page scrolls to the top and I have to scroll down again to click the button.
Is there any way to save the scroll position in ADF . I tried to call Java script
Window.scrollto () method
But for other methods it's working fine but not after clicking on the af message ok button.
Please let me know any way to scroll down to the bottom of the page.
markosca already gave the correct hints as a comment.
I'll clarify a bit on this for the sake of a complete answer:
If your buttons trigger an action, always a complete new site will be loaded.
Even if the "new" site is equal to the old one, it will seem as if the site has scrolled up.
If your buttons have an actionListener registered, this scrolling will also happen. Even if you put an addPartialTarget(...) inside that registered Java-method.
So, how to solve this? It's easy, just use an actionListener and the attribute partialSubmit="true" on the button or link.
Only than a partial submit will be executed instead of a full page reload.
And don't forget to either use addPartialTarget(...) in Java or the attribute partialTriggers="..." on the components which should update because of that partial submit.
I have a simple form inside a Bootstrap modal popup. The form was working fine until I needed to add a button to perform a simple calculation based on some values entered into the form.
The button just has a jQuery click event which grabs the values from the form elements, does the calculation the writes that value into a text box. When the form is not in the modal, it works just fine. Zero errors. When the form is in the modal clicking the button closes the modal and I cannot see why.
I have stripped back the button to bare bones and even removed the jquery code in the click event handler.. it still closes the modal. I have removed the form action event (points to a .php script), but the modal still closes.
When it closes I see that the browser address bar is filled with the URL for the page with all the form values as params as the field were populated when I clicked the button.
Can anyone tell me how I can get this button to just be a trivial button I can use for this purpose and NOT close the modal?
I have removed the form action event (points to a .php script), but the modal still closes.
Removing the action attribute just sets the action to the URL of the current page. It doesn't prevent the form from being submitted.
Can anyone tell me how I can get this button to just be a trivial button I can use for this purpose and NOT close the modal?
The crappy quick way
<button type="button"> will make the button a JavaScript only button and not a submit button
The proper way
In your event handler function, capture the event object and call its preventDefault() method.
Make sure that on those occasions when the JS fails, the server does the right thing and provides a sensible response for the form submission.
The probelm is very likely that the button submits the form. Try specifying <button type="button"> or add a evt.preventDefault() in the click handler.
Can I know what is the best solution for my question. I got a data entry page with multiple input textbox inside a form on the main page. After enter and click the submit button, I want it to open the result page in a modal popup window.
Two different asp files.
1) Main.asp (Input)
2) Result.asp (get Input from Main to generate the result)
The main.asp is for data entry while the result.asp will retrieves the parameter pass by the main page for further processing and generate the result. The result.asp need to have a button to close the popup window and reset the main.asp textbox.
You can't POST a form directly into a modal window. Alternatively, you could:
Intercept the JavaScript form.onsubmit event
Manually build the querystring
Open the modal with the informed parameters and,
When the user closes it, clear the required fields on the main page.
I have a html page that have radio buttons that initially are all unset - this is by design.
The problem is if you move forward and then use the browser back button you could get to the page in a weird state, because the browsers reset some stuff, but not the radio buttons.
Is there event that I could handle to reset all I need when I get to the page with a back button?
I am trying to see witch one i like best, Tiny MCE or CKEditor. The problem that i am getting is that i need to add a custom toolbar button (or extend the anchor button). Trying now to modify the advlink plugin to insert internal links from the CMS. So i modified the page link.htm and added one button next to the href field. This button opens up a small popup where the user can select an internal link in the CMS and then press insert. The small popup then uses javascript to send the result back to the link.htm page. The link is then inserted into the href field. My problem is that when i press insert on the link.htm page, it just reloads the page and nothing is inserted.
This is the javascript that i added to the link.htm page:
function ShowInternalLinks() {
window.open('InternalLink.aspx', 'InternalLink', 'toolbar=0,status=0,menubar=0,location=0,directories=0,resizable=0,scrollbar=0,width=400,height=200');
}
function InsertInternalLink(link) {
document.getElementById('href').value = '/1/?' + link;
}
Nothing fancy, just opens up my custom aspx page when the ShowInternalLink is clicked. Then when the user clicks on insert on that page, the page calls the javascript InsertInternalLink and then closes the small popup. Everything works when i run the page, the href gets the correct value from the popup page, but when i then press insert, the page just reloads and the href field resets itself.
Any ideas? (If i write in the URL in the href field, it works perfectly. Just doesn't work when i use my popup window)
Side question: Can this even be done easily in CKEditor?
The href field has an onchange listener that performs the following: selectByValue(this.form,'linklisthref',this.value);
Can you debug and see if this is being called. I'm thinking that it isn't, and this might be your problem.