I have a problem regarding modal popup and session.
I have two component name test and test1 respectively.
In test there is a form in view in which i put "Anchor" tag with "modal" class. has also class name "class1".
When i clicked on Anchor tag it call click function(on click "class1") in which i put ajax code for set data using "Session".
$('.test').click(function(){
// Ajax code here for set data using session
});
with above function it also called modal popup. here targer url is seted which is the view of 2nd component which is "test1".
Here in test1 there is a view.html , we are getting session data here and displaying in view.
PROBLEM
Problem is that , here in 2nd component , in view i am getting session data but i need to click on button two time , only after i getting data properly.
When i click on it give me a old session data. and when i click on it second time it will give me a proper data.
What is the solution for above problem. if anyone know please let me know.
Session data is altered only after we click on Anchor tag.
Both thing is done on Anchor click , one is for set data in session and second is for modal popup. in popup i am getting data which set in session.
when is the session data is being altered?
Is it altered by ajax call too?
In this case, javascript, is unsynchronous. It doesn't wait for something to happen in order to fire the next line of code. In that case there are several techniques you may find to do so.
Related
I have used Fresh MVMM. I need to pass a data from one page model to another page model without using init and reverse init.
Eg: I have one toggle button in first content page.
I need to toggled the button based on the selection in second popup page without popup the second PopPopupPageModel.
ReverseInit is worked when popup the second PopPopupPageModel and can easily pass data.
But I need to toogled the button in first page without popup the second page.
Please help...
I have a function that returns a value (e.g.27).
I am put this value to my page item (P2120_SYMPTOM_ID) and i want with this value to open with button another page (P2140).
I am going to button Link builder - target and i am using P2120_SYMPTOM_ID like this:
but unfortunatendly this value doesn't pass to my new page criteria.
How can i use this value?
If you're just navigating to another page (as opposed to opening a modal window) then use action "Submit" on your button and create a branch to the new page. That is how navigation is supposed to be done. The link builder links are generated when the page is rendered and do not pick up session values.
This is a common question, and relates to the fact the link uses values during page render, not what may have happened during interaction with the page
A common solution is presented in the Oracle forums here
https://community.oracle.com/tech/developers/discussion/3725149/pass-client-side-state-to-modal-dialog
Alternatively, there is a free & supported FOEX Redirect plugin that also solves this problem
https://fos.world/ords/f?p=10000:1080
Working on some old code at the moment and a bit stuck
I have a main form that has a msflexgrid populated with data from SQL and on this form there is a button, which opens a modal form that allows me to enter data and save it to SQL (then closes the form).
The issue is the msflexgrid on the main form doesn't refresh after I save data from the modal, I need a way of automatically refreshing the msflexgrid after the modal form closes.
Any help would be appreciated :)
Maintain a global structure and update it when the changes are committed in the modal form. After modal form is unloaded, control comes back to the command button click event in main form and there, you update the msflexgrid with the data available in the global structure. Like this, explicitly we need to update the msflexgrid and it is not refreshed automatically.
It just hit me that because the second form is a modal form it only return to the main form when the second form unloads, so I can just add the refresh function right after showing the second form, I knew I was doing something stupid :/
Dim AddBusContact As New frmAddBusContact
AddBusContact.SetBusID (clsThisForm.BusID)
AddBusContact.Show (vbModal) 'code stops here until second form is unloaded
refreshgrid 'and I can just call the function that refreshes the grid here
I would suggest one more idea. If the modal form allows the user to cancel action, or to give up what started to do, probably it is better to trigger the grid refresh function before the modal form unloads and only if changes have been made...
I am converting an old web application. In the legacy version, there is a page which displays some default content when the user navigates to it. There is a link within that page which reloads the page but with a querystring showform=yes which causes a form to be displayed instead of the content.
In the old version, the page was like this:
http://site.com/directory.asp - for the main page with the content
http://site.com/directory.asp?showform=yes - called when the user
clicked the button to show the form.
In the new version of the web app, that same page is set up with ajax, in that there is a div which contains the default content when someone visits http://site.com/directory. There is a button, which, when clicked (from within that page), some ajax is invoked which swaps out the content and displays the form. There is no change in the URI/querystring.
Here is my question - In the legacy version of the web app, there are some other pages which link the user directly to the page with the form (http://site.com/directory.asp?showform=yes) e.g. so they don't need to click the button once the arrive at directory.asp.
Is there a what I can mimimc this behavior based on how I have that page set up now e.g. displaying the form via ajax in a div?)
Initially I thought that perhaps ajax can be triggered based on the presence of a querystring or an anchor in the URI e.g. /directory#form but I am not sure if that is possible.
I would prefer a solution that is not dependent on jQuery, but will consider it if there are no other options.
Thanks in advance for looking, and please let me know if I can further clarify.
Thanks,
Gary
yes you can trigger AJAX call on the basis of a boolean variable which you can set through the query string.
The default value for the boolean variable is false which forces the user to click on the button to refresh the form section.
But when the comes back on the same page the query string will set the boolean variable to true whereby the javascript function containing the AJAX code is invoked from your JSP/ASP or HTML.
I have a bootstrap dropdown button for each table row.
When the dropdown is clicked it shows a small form with some input fields.
When the user submits this form data or the row gets redrawn the dropdown closes.
I tried preserving the dropdown state using the Template.preserve() method, similar to inputs but with no success.
Some suggested using {{#constant}} directive surrounding the dropdown I also have some reactive content inside the form that needs re-rendering, so this options is not for me.
I have noticed this issue with reactive templates and there is no good solution that I know of. This is somewhat of a hack but it works.
Option 1
Manually add and remove a css class to your dropdown. Use session variables to save the state of the dropdown.
This should be the default state of your dropdown... class="dropdown"
When a user clicks on the dropdown use a session variable to save its state and add 'open' to the HTML class attribute. class="dropdown open"
When a user closes the dropdown remove 'open'
Option 2:
1. User clicks dropdown button.
2. Save dropdown button ID as active using a session variable.
3. Use the following callback to reopen your dropdown... Template.myTemplate.rendered = function ( ) {
if (dropdown = active) {
$().dropdown('toggle'); //instead of toggle try 'open'
}
}
I haven't tried this with dropdowns yet but I was having the same issue with modals disappearing every time the template kept rendering. I tried the second option and it didn't work that great. I ended up using something like the first option to solve the issue and it worked great.