Forced spry:state
Hello,
I'm wondering if I can force the spry:state="error" from the
server. Here's what I'm attempting to do:
1. User logs in using a form.
2. Login name / password verification script (in PHP) creates
a session cookie with a randomly generated code and updates a user
db with that code to track the session.
3. When the user requests data, the server side script (in
php) first validates the cookie against the session code in the
database and returns the requested data if the code in the cookie
matches the code in the db. (if exists).
4. If the cookie does not exist or does not match, then I'd
like the script to return a spry:state="error" and have the html in
that state block displayed (requests the user to log in, or
redirects them to a login page).
I've seen a post where it was suggested to return an empty
set, but this is a somewhat different behavior. Can you force a
spry:state to "error"? Am I over complicating this whole process?
You can force a region to display a specific state
programatically like this:
var rgn = Spry.Data.getRegion("myRgnName");
if (rgn)
rgn.setState("error");
You can see this being done in this sample:
http://labs.adobe.com/technologies/spry/samples/data_region/RegionStatesSample.html
Also check out state mapping:
http://labs.adobe.com/technologies/spry/samples/data_region/StateMappingSample.html
--== Kin ==--
Similar Messages
-
Spry:state and dynamic accordion
When I use a dynamic accordion (i.e. populated by a dataSet),
the accordion functionality disappears. Here is my code. Am I doing
something wrong, or is this just a bug?
Thanks
Andy
<div spry:region="dsOrders">
<div spry:state="loading">Data is
loading...</div>
<div spry:state="error">Error loading
data...</div>
<div spry:state="ready">
<div id="orders" class="Accordion">
<div class="AccordionPanel" spry:repeat="dsOrders">
<div class="AccordionPanelTab"><h3
spry:content="{ORDERNUM}"></h3></div>
<div class="AccordionPanelContent"><span
spry:content="{ORDERDATE}"></span></div>
</div>
</div>
</div>
</div>This might also be helpful to some. Not only do we have
states in SPRY... but events! Here is how I did it on a site that
has a dataset called dsOpportunities. The following HTML/Javascript
was added to the head tags of the HTML. Then the on <body
onload="afterReady()" > was used to make sure it was run.
Remember that your section you are hiding needs to have a class
with the same senario. (Or if it is unique you could do something
simular with ID rather than class.
<script>
function afterReady() {
$('pageContent').style.visibility = 'hidden';
var iSPRY = new Object;
iSPRY.onPostLoad = function(dataSet,data) {
$('pageContent').style.visibility = 'visible';
dsOpportunities.addObserver(iSPRY);
</script>
<style>
.pageContent {
visibility: hidden;
</style> -
Spry:state="loading" for Spry.Utils.updateContent
It would be very handy to be able to use something like
spry:state="loading" for Spry.Utils.updateContent. Right now it
seems you can only use the :state="loading" for regions. Makes
sense but being able to activate the loading div while update
content is running would also be very handy. To that matter for
waiting for tabs to load, etc.Cool. Thanks for the reference, Andrew!
-
Spry:state not working properly
Hi,
I have the following code wrapped around my page:
<div spry:state="loading"
class="AjaxLoadingLarge">Loading...</div>
<div spry:state="error">Sorry! An Error has
occurred!</div>
<div spry:state="ready">
PAGE CODE HERE
</div>
Whilst the page is loading, the Loading State Appears on the
screen normally but also has the Error State Content and the Ready
State Content (unpopulated with Data) - ie it's the table with all
the header row and 1 results row displaying the dataset field names
{EventID} {EventDesc} etc.
Once the page is loaded, everything displays perfectly, It
just looks as though the "state" is not being handled properly
until the state becomes ready.
Anyone else seen this problem? and any ideas?
DomHi - Thanks for the response.
The previous line of code now reads:
<div spry:region="ds1" class="SpryHiddenRegion">
and I have closed the DIV off but it has made no difference
whatsoever - but there is no class in any .css for this.
Having Googled this, I found that some people have a class in
the .css as display:none. I added this and nothing is then visible.
Any further ideas?
Dom -
Using spry:state="loading" only after a certain interval
Hi everyone ,
I need a feature for spry regions. I want my loading spry state to show only loading of data takes 0.5 seconds and more.
Is it possible with this version of spry?
Ps1 : you can find a live example of my need in google webmaster tools' content section,content by title page. There is an ajax listview with paging on page and loading div only apeears if loading of data takes more than a certain milliseconds.
Ps2 : Spry rulezzzzvw2ureg wrote:
Hi,
Go here and scroll down to ErrorState, LoadingState and ReadyState.
I hope this helps.
Ben
That will only tell Spry that it should should use different "state" as loading state. But it doesn't display a loading state after a certain interval. This functionality does not exist in the Spry library. But you could create a custom "loading" state that you automatically trigger using setTimeout if your haven't gotten a onPostUpdate through your region observer.
But i'm curious why you would wanna do create a have the loading state after a certain interval. -
Spry:State and PagedView
Dear Member,
hope that somebody can help me this time..
I am using spry, and a lot of trick to make it work.
The spry:state="loading" options don't wanna work for me
it's only work if i don't use the PagedView...
Here the simple code
I have a simple XMLdataset:
var dsmio = new Spry.Data.XMLDataSet("Xml/filexxx.asp", "Clienti/Cliente", {sortOnLoad: "RagioneSociale", sortOrderOnLoad: "ascending", useCache: false});
and a pagination on it:
var paginazione = new Spry.Data.PagedView( dsmio ,{ pageSize: 50 });
finally the code to show my data:
<div spry:region="paginazione">
<div spry:state="loading">Loading Data - Please stand by...</div>
<div spry:state="error">OPS, something went wrong!</div>
<div spry:state="ready">
<table width="100%">
<tr>
<th width="25%" height="20" align="left" bgcolor="#CCCCCC" spry:sort="RagioneSociale">RagioneSociale</th>
<th width="25%" height="20" align="left" bgcolor="#CCCCCC" spry:sort="Email">Email</th>
<th width="25%" height="20" align="left" bgcolor="#CCCCCC" spry:sort="Telefono">Telefono</th>
<th width="25%" height="20" align="left" bgcolor="#CCCCCC" spry:sort="PersonaRiferimento">PersonaRiferimento</th>
</tr>
<tr spry:repeat="paginazione" class="{ds_EvenOddRow}">
<td width="25%" height="20">{RagioneSociale}</td>
<td width="25%" height="20">{Email}</td>
<td width="25%" height="20">{Telefono}</td>
<td width="25%" height="20">{PersonaRiferimento}</td>
</tr>
</table>
</div>
Hope some Guru can help meHi guys!
This is easy to solve:
You have to work in two different regions!
<div spry:region="dsmio">
--- Put the loader here...
</div>
<div spry:region="paginazione">
content
</div>
You can hide the "layout" of the content by :
<div id="content" spry:if="'{ds_PageTotalItemCount}' != ' ' ">
content...
</div>
ds_PageTotalItemCount is empty during loading.....
Have fun & keep coding -
Spry:state unexpected results
I am using Spry/AJAX to populate a page, but whenever the
page loads you see the dynamic content tags in the form fields and
then it reloads with the data in the form fields. Is there any way
to make it not show the dynamic content tags and just show the form
once the data is in the form fields? Go to the following link to
see what I mean:
http://www.homesandagents.com/Members/contact_info.asp?userID=10000&sessionID=&contactID=1 0064
I tried using spry:state="loading", but it still shows the
form with the dynamic tags first (ie. {last_name}), then the
loading state, and then finally the ready state.I'm not seeing the data references when I load your page. But
that may be due to the fact that it looks like you've added the
SpryHiddenRegion class to your region.
--== Kin ==-- -
How do I make the spry:state="loading" work with your image
gallery? I can get it to work just fine when its loading dataset
but when you click a thumbnail it doesnt work the same. would the
spry:state need to be added to the gallery.js since that has the
function that handles the changing of the image?Hi,
The spry:state="loading" attribute can be used only inside a
spry:region or spry:detailregion - it's content is diplayed while
the
markup gets updated, but this doesn't include the time all
the resources inside that markup are downloaded (for example, if
there are images inside that region, when the spry:region gets
updated, the "loading" content is displayed only for the time the
markup containing <img src=".."> gets inside the page.
Loading is not displayed while the image is actually downloaded by
the browser).
For the gallery demo, the markup for the big image is not
inside a spry:region because the url for the image is set from
custom functions inside gallery.js that uses data from the existing
datasets. It's done this way because effects are added when the
image is displayed.
regards,
Dragos -
How to compile the hint to force selection statement to use index
Hello expert,
will you please tell me how to compile the hint to force selection statement to use index?
Many Thanks,Not sure what you mean by compile, but hint is enclosed in /*+ hint */. Index hint is INDEX(table_name,index_name). For example:
SQL> explain plan for
2 select * from emp
3 /
Explained.
SQL> @?\rdbms\admin\utlxpls
PLAN_TABLE_OUTPUT
Plan hash value: 3956160932
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 14 | 546 | 3 (0)| 00:00:01 |
| 1 | TABLE ACCESS FULL| EMP | 14 | 546 | 3 (0)| 00:00:01 |
8 rows selected.
SQL> explain plan for
2 select /*+ index(emp,pk_emp) */ *
3 from emp
4 /
Explained.
SQL> @?\rdbms\admin\utlxpls
PLAN_TABLE_OUTPUT
Plan hash value: 4170700152
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 14 | 546 | 2 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| EMP | 14 | 546 | 2 (0)| 00:00:01 |
| 2 | INDEX FULL SCAN | PK_EMP | 14 | | 1 (0)| 00:00:01 |
9 rows selected.
SQL> Hint in the above example is forcing optimizer to use index which resul;ts in a bad execution plan. Most of the time optimizer does not need hints and chooses an optimal plan. In most cases sub-optimal plan is result of stale or incomplete statistics.
SY. -
Spry:state="error" field is always visible?!
I define layers to display the current spry:state, one for
spry:state="loading", the second for spry:state="error" and the
third for spry:state="ready". The problem is that
spry:state="error" field is always visible along with
spry:state="loading"?! Am I making some mistake or what? Here is a
part of relevant code:
<div id="vijesti" spry:region="pvVijestiMini"
class="vijestimini">
<div id="ucitavanjemini" spry:state="loading"
class="indikator">
<p>
<span><img
src="slike/pomocne/loader.gif"></span>
<span>Podaci se učitavaju...</span>
</p>
</div>
<div id="greskamini" spry:state="error"
class="indikator">
<p>
<span><img
src="slike/pomocne/loader2.gif"></span>
<span>Podaci ne postoje ili su
nedostupni...</span>
</p>
</div>
<div id="podaci" spry:state="ready">
<span class="vijestnaslov">Čikom vijesti
[{ds_UnfilteredRowCount}]</span>
<div id="redovimini" class="redovimini">
<div class="red" spry:repeat="pvVijestiMini">
<p class="podnaslov">
<span>{datum}</span><br>
<span class="naziv">{naziv}</span>
</p>
<p>
<span>{ukratko}<a
href="index.php?jezik=0&meni1=3&meni2=0&meni3=0"><img
src="slike/pomocne/dalje.gif"
class="dalje"></a></span>
</p>
</div>
</div>
<div id="navigacija">
<div spry:if="{ds_UnfilteredRowCount} == 0">Nema
podataka u tabeli "Vijesti"!</div>
<div spry:if="{ds_UnfilteredRowCount} > 0">
<div><a href="#"
onclick="pvVijestiMini.firstPage(); return
false;">|<</a><span> </span></div>
<div><a href="#"
onclick="pvVijestiMini.previousPage(); return
false;"><<</a></div>
<div> stranica {ds_PageNumber} od
{ds_PageCount} </div>
<div><a href="#" onclick="pvVijestiMini.nextPage();
return
false;">>></a><span> </span></div>
<div><a href="#" onclick="pvVijestiMini.lastPage();
return false;">>|</a></div>
</div>
</div>
</div>
</div>
The second question: How do I hide region container until it
gets filled with data?Look, you got me all wrong. I don't want to hide a main
region, just the spry:state="error" appearing the same time as
spry:state="loading"!!!
<div id="ucitavanjemini" spry:state="loading"
class="indikator">
<p>
<span><img
src="slike/pomocne/loader.gif"></span>
<span>Podaci se učitavaju...</span>
</p>
</div>
<div id="greskamini" spry:state="error"
class="indikator">
<p>
<span><img
src="slike/pomocne/loader2.gif"></span>
<span>Podaci ne postoje ili su
nedostupni...</span>
</p>
</div> -
How to force spry to render properly?
Does anybody have a hack to spry, to force it to render
crlfs? Could do javascript replaces with <br> but spry will
not render those. Could have the replace done in the database
layer, but spry still refuses to render those as well.
You could have a cold fusion page in the middle of spry calls
to do the replace, but spry loves weeding out anything done in CF
After a search on google, there is nothing shown on how to do
this with spry ... have anybody else run into this issue?I would suggest making sure SEQUENCE--->RENDER ALL has a checkmark next to every one of them...though the end result should be the same as previously suggested. Pressing Option R sometimes renders everything when you have it selected that even Command R doesn't render.
-
Spry state to show a message for a failed dsMonth.loadData() action
Below is my code:
<script type="text/javascript">
var dsMonth = new
Spry.Data.XMLDataSet("DATA/2008/January.xml", "month");
function ds_setMonth(month){
dsMonth.setURL("DATA/2008/"+month+".xml");
dsMonth.loadData();
</script>
</head>
<body>
<input type="button" value="Set month to February"
onclick="ds_setMonth('February')" />
<div id="DataTable" spry:detailregion="dsMonth">
<div spry:repeat="dsMonth">{@id} {name}
{items}</div>
</div>
In case the file "DATA/2008/February.xml" doesn't exist, I
want the region <div id="DataTable"... that previously shows the
data from
"DATA/2008/January.xml" to turn out blank, and contain a
message "Data for February hasn't been updated yet". How can I do
this?
Thanks for all your helps.I should mention that in this sample I presumed the file
existed but didn't have any data.
<event>
<date>
</date>
</event>
If the is no file on the server, you can use the error state
to show it.
http://labs.adobe.com/technologies/spry/samples/data_region/RegionStatesSample.html -
Use single message with multiple spry "states"
forgotten past decided to use spry widgets to do the validation. One of the things that can get old pretty quick is to have to create a different message for each thing that can go wrong, even if you need to display the same message. For example, if a user needs to enter 9 digits, the message for entering too few, too many, and letters can pretty much be handled by "The value should be exactly 9 digits."
Is there a way to use just one div/span and have it show for all of these conditions? I need to be able to code this manually, because for whatever reason the widgets don't show up properly in the DW UI (either because it's an old version or because the widgets have been edited by hand at some point in a way that's incompatible with the DW UI). It also needs to be compatible with older browsers (i.e. I could probably do this by assigning multiple classes to the element(s), but I am not sure what browsers would support this). Many of our users are in libraries, so we have to anticipate that the browser may not be up-to-date.Don't use Spry. Adobe abandoned the framework in 2012. It is no longer supported.
Best advice, use HTML5 forms alone or with jQuery validation. In the following example, the number field requires 9 characters. This works in modern browsers.
<form id="MyForm">
<label for="number">Number:</label>
<input name="number" type="number" id="number" placeholder="123456789" maxlength="9" minlength="9" required>
<input id="submit" name="submit" type="submit" value="SEND">
</form>
For older browsers that don't support HTML5 forms, you can add jQuery validation to your forms by adding this to your document's <head> tag.
<!--LATEST JQUERY CORE LIBRARY-->
<script src="http://code.jquery.com/jquery-latest.min.js">
</script>
<!--JQUERY VALIDATE PLUGIN-->
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js">
</script>
<!--INVOKE FORM VALIDATION-->
<script>
$(document).ready(function() {
$("#MyForm").validate();
</script>
Nancy O. -
How Do I force SPRY accordion to position active tab at top of browser?
I am using the 'goToByScroll' script to try to force an accordion to open with the active accordion tab at the top of the browser window instead of the top of the entire accordion appearing at the top of the browser window. I believe the Accordion default setting of placing the accordion at the top of the browser window is interfering with the script. Does anyone know how to modify the JS file to stop the accordion positioning when a tab is selected? If I select the first panel it opens fine, but the second panel opens about half way down. Here is one of the pages:
http://www.davidkneale.com/wcusa/ecuador.html
Any help appreciated!
ThanksThanks for your reply. This appears to disable the goToByScroll functionality which I want to work. Apologies if my original post was confusing, but I believe it is the default browser position action of the Accordion that I think I want to disable.
If you click on the first accordion item it opens at the top of the browser window correctly, however if you then select the second tab beneath it the content scrolls up about half way above the top of the browser window. This problem could be unrelated to the default accordion position behaviour, however I've pretty much tried everything else to fix this!
The tabs are quiter large, and all I really want is for the active tab to be at the top of the browser window, not the entire accordion. Would prefer to use goToByScroll but will happily ditch it if this is not possible. -
Force some statements when exiting program
Hello,
I have created a class,
I want that when the program exits,
it should have a code that will be done before the program exits.
The following is for initialization :
public class myClass {
Static {
... do something
// what should I put here for finalization ?
Thanks :)addShutdownHook doesn't work for some conditions
(it seems to be work for simple pure java)
If I do :
JOptionPane.showMessageDialog ... - doesn't work
System.out.println ... - work !!!
Thanks :)A quote from one of the references found by the following search
Because shutdown hooks run as threads, you must use thread-safe programming techniques. Otherwise you risk having threads interfere with each other. Also, it's wise to design your application for simple and fast shutdown processing. For example, you might run into trouble if your application uses services during shutdown that are themselves in the processing of being shut down.
http://www.google.com/search?q=java%2bshutdown%2bhook
Maybe you are looking for
-
First Time Log in by BPEL Console
Dear All, I have installed BPEL Process Manager 10.1.3.1 and also I have jDeveloper studio 10.1.3. I start BPEL PM Server and then Open BPEL Console but I can not log in with default user name, i.e "oc4jadmin" or "bpeladmin". Which user name and pass
-
Help with Annotations in iMovie to Quicktime Pro to iPod Workflow
This is what I want my content to do: a) play in a webpage b) be downloadable and open automatically in iTunes/play on iPod c) additionally, I want the content to be annotated, so that when it is download and opened in iTunes automatically (rather th
-
We are getting this error when stopping our AddOn "Addon failed with exception; Event Type 6" even though the addon stops correctly hhow can we overcome this error
-
How to read more than 132 char using Read_Text Fn. Module
Hi, I am using Fn. Module <b>Read_Text</b> in my program, but the fn. module is only retrieving 132char data and remaining data is getting truncated. In my case Text size is more than 132char...pls, let me Know, how can i get entire text or i have to
-
External Monitor "shivers" on MacBook Air
I have attached a 27" HP 2711x monitor to my MacBook Air using the mini-port->vga adaptor. The display is recognised as HP 2711 and the resolution is set to 1920x1080. Looks great. However, every so often (like every 3-5 minutes), the whole display '