Thread: Set item value using AJAX

This question is answered.


Permlink Replies: 10 - Pages: 1 - Last Post: Jan 19, 2009 5:02 AM Last Post By: /dev/null
/dev/null

Posts: 407
Registered: 10/15/07
Set item value using AJAX
Posted: Jan 16, 2009 4:07 AM
 
Click to report abuse...   Click to reply to this thread Reply
I want to first set the value of an item and then re-direct to a page. This must be done in javascript (for various reasons). I am OK with the redirect (just calling the APEX redirect() function) however I would like to be able to update an item value first. I assume this is job for AJAX? I am not able to submit the page before re-direction.

Thank-you
BillC

Posts: 858
Registered: 04/18/06
Re: Set item value using AJAX
Posted: Jan 16, 2009 5:52 AM   in response to: /dev/null in response to: /dev/null
 
Click to report abuse...   Click to reply to this thread Reply
Hi,
I don't think you have gotten and responses because it seems to be a bit unclear about what you are trying to do.

You are in a page and someone hits a button and it redirects to another page? and you want to set an ITEM before it goes? or a database item?
You are wanting to do an update to the database with AJAX as it redirects?
Bill
ATD

Posts: 8,839
Registered: 04/17/06
Re: Set item value using AJAX
Posted: Jan 17, 2009 1:52 AM   in response to: /dev/null in response to: /dev/null
 
Click to report abuse...   Click to reply to this thread Reply
Hi,

It does depend on what you mean by "update an item value first".

If you just mean that you want to go from page 1 to page 2 and, during the redirect, you want to set an item on page 2, then this can be done in the URL (you can set any page item value in the URL, it doesn't just have to be on the page that you are transferring to).

If you mean that you have to update a value on a table, then you can either use Ajax OR you can pass a value to page 2 and have a process run on page 2 that does the update for you (perhaps passing a request name in the URL and setting the process to be conditional on this value).

Andy
Denes Kubicek

Posts: 4,750
Registered: 06/22/00
Re: Set item value using AJAX
Posted: Jan 17, 2009 8:13 AM   in response to: /dev/null in response to: /dev/null
Correct
Click to report abuse...   Click to reply to this thread Reply
/dev/null

Posts: 407
Registered: 10/15/07
Re: Set item value using AJAX
Posted: Jan 18, 2009 11:43 PM   in response to: Denes Kubicek in response to: Denes Kubicek
 
Click to report abuse...   Click to reply to this thread Reply
^ Thanks - I will give that a try and let you know later.

I can't set it in the URL unfortunately. Very basically I am using an iFrame on a page which I have a button on the parent frame to break out of the frame and display the URL inside the iFrame - something along these lines:

<script>
function redir() {
  var url=window.frames['iframe_window'].location.href;
  redirect(url); 
}
</script>


Yes, there are various reasons why! :)
ATD

Posts: 8,839
Registered: 04/17/06
Re: Set item value using AJAX
Posted: Jan 18, 2009 11:48 PM   in response to: /dev/null in response to: /dev/null
 
Click to report abuse...   Click to reply to this thread Reply
IFrames!!! I guest Ajax is the way to go then :D

Andy
/dev/null

Posts: 407
Registered: 10/15/07
Re: Set item value using AJAX
Posted: Jan 18, 2009 11:55 PM   in response to: ATD in response to: ATD
 
Click to report abuse...   Click to reply to this thread Reply
Yes, they're being used to create a (primitive) touch-screen mode for an application whereby the content is in an iframe with large buttons to scroll etc. The screen needs to be able to toggle between both touchscreen and normal mode though. Sounds like a strange thing to do but without going into too much detail, it's difficult to explain everything!! :)
ATD

Posts: 8,839
Registered: 04/17/06
Re: Set item value using AJAX
Posted: Jan 19, 2009 12:10 AM   in response to: /dev/null in response to: /dev/null
 
Click to report abuse...   Click to reply to this thread Reply
"Touch screen"? Crikey, that's the first I've heard of Apex being used for that!

Andy
/dev/null

Posts: 407
Registered: 10/15/07
Re: Set item value using AJAX
Posted: Jan 19, 2009 1:14 AM   in response to: ATD in response to: ATD
 
Click to report abuse...   Click to reply to this thread Reply
lol - apart from the issue above, it actually works quite well! :)
Bit of CSS required here and there to make things bigger, more easily accessible etc but not a great deal.
ATD

Posts: 8,839
Registered: 04/17/06
Re: Set item value using AJAX
Posted: Jan 19, 2009 1:18 AM   in response to: /dev/null in response to: /dev/null
 
Click to report abuse...   Click to reply to this thread Reply
If things go the way people suggest, then we'll all be using touchscreens - so, you'll be the expert we can call on ;)
/dev/null

Posts: 407
Registered: 10/15/07
Re: Set item value using AJAX
Posted: Jan 19, 2009 5:02 AM   in response to: ATD in response to: ATD
 
Click to report abuse...   Click to reply to this thread Reply
Got the AJAX method working fine - thank-you very much! :)
Legend
Guru Guru : 2500 - 1000000 pts
Expert Expert : 1000 - 2499 pts
Pro Pro : 500 - 999 pts
Journeyman Journeyman : 200 - 499 pts
Newbie Newbie : 0 - 199 pts
Oracle ACE Director
Oracle ACE Member
Oracle Employee ACE
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums