PDA

View Full Version : Logon Dialog box (form based security) - help please!



h2hjastermereel
2 Nov 2006, 9:03 PM
Need help with a dialog control interacting with form based security, this is where I am:



<page>
<DOCTYPE>
<html>
<head>
<meta>
<title>YAHOO.widget.Dialog</title>

<script></script>
<script></script>
<script></script>
<script></script>
<script></script>
<script></script>

<link>
<link>
<link>
<link>

<script></script>


<script>
YAHOO.namespace('example.container');

function submitCallback(obj) {
var response = obj.responseText;
response = response.split("<!")[0];
document.getElementById("resp").innerHTML = response;
eval(response);
}

function submitFailure(obj) {
alert("Submission failed: " + obj.status);
}

function init() {
var handleCancel = function() {
this.cancel();
}
var handleSubmit = function() {
this.submit();
}


YAHOO.example.container.dlg = new YAHOO.widget.Dialog("dlg", { modal:true, visible:false, width:"350px", fixedcenter:true, constraintoviewport:true, draggable:false });

YAHOO.example.container.dlg.callback.success = submitCallback;
YAHOO.example.container.dlg.callback.failure = submitFailure;

var listeners = new YAHOO.util.KeyListener(document, { keys : 27 }, {fn:handleCancel,scope:YAHOO.example.container.dlg,correctScope:true} );

YAHOO.example.container.dlg.cfg.queueProperty("keylisteners", listeners);

YAHOO.example.container.dlg.cfg.queueProperty("buttons", [ { text:"Logon", handler:handleSubmit } ]);

YAHOO.example.container.dlg.cfg.setProperty('postmethod','none');

var handleManual = function(type, args, obj) {
alert("Manual submission of " + this.id + " detected");
}

YAHOO.example.container.dlg.manualSubmitEvent.subscribe(handleManual, YAHOO.example.container.dlg, true);
YAHOO.example.container.dlg.render();
}

YAHOO.util.Event.addListener(window, "load", init);

</script>
</head>
<body>
<YAHOO>
<div>
<div>
<h1>Logon Example</h1>
</div>
<div>


<button>Logon</button>
</p>
</div>
<div></div>
</div>
<div>
<div>Please Logon:</div>
<div>
<form>
<table>
<tr>
<td>User Name:</td>
<td><input></td>
</tr>
<tr>
<td>Password:</td>
<td><input></td>
</tr>
<!-- Save/Reset buttons
<tr>
<td>
<input>

<input>
</td>
</tr> -->
</table>
</form>
</div>
</div>
</body>
</html>


it is not working, any ideas?

jack.slocum
3 Nov 2006, 1:00 AM
Check out forum.js linked off http://www.jackslocum.com/forum2/ , is uses a YUI dialog to do a login form.

h2hjastermereel
3 Nov 2006, 9:43 AM
Where? I do not see where you want me to look? (yes I clicked the link).

R.

jack.slocum
3 Nov 2006, 12:13 PM
Did you look at the forum.js file that it references?

h2hjastermereel
3 Nov 2006, 1:01 PM
I am soooo missing something. I click the link and it just takes me to the forums in another form. No clue where this forum.js is??!!

jack.slocum
3 Nov 2006, 1:11 PM
You can view source and look at the forum.js file referenced?

Here's a link directly to it:

http://www.jackslocum.com/forum2/javascript/forum.js

h2hjastermereel
3 Nov 2006, 1:27 PM
Any chance of showing me a small example of implementing signin : function() ? What would the calling code look like?

(new to all this)

R.

tryanDLS
3 Nov 2006, 1:32 PM
The forum2 page is the example :)

Right click and view source - you can pull all the code down to your PC and run it locally after maybe changing a few file paths if your directory structure doesn't match.

h2hjastermereel
3 Nov 2006, 2:57 PM
I was really looking forward to integrating form based security and the dialog box, but I cannot get it to work properly (submit then redirect to correct page).

R.