How can I code af custom HTML form for login to Vanilla from another page on same domain?
Dear readers,
I have a small HTML form that posts to the /entry/singin. However, with a recent update to the Vanilla Forum it has broken down and I am looking for ways to fix this.
<form id="Form_User_SignIn" action="/forum/entry/signing.php" method="post" target="_blank"> <strong>Forum:</strong> <input type="text" id="Form_Email" name="Email" value="Username" class="required" onFocus="this.value=''"/> <input type="password" id="Form_Password" name="Password" value="Password" class="required" onFocus="this.value=''"/> <input type="submit" id="Form_SignIn" name="Sign_In" value="Login" /> </form>
It references, but requires the user to press submit AGAIN on the page in order to log-in. This has to do with the TransientKey not being with the original forum.
Vanilla is embeded in /forum/ on the same domain as the index.html which contains the reference HTML form.
Thank you for your help!
Yours kindly,
Chris
Answers
Any suggestions would be welcome!
If in Vanilla, using the framwork.
Outside suggest using javascript
see
http://vanillaforums.org/entry/signin?DeliveryType=VIEW
That fetches the form (you will need to style it)
example load this script (presumes you are using jQuery)
Put this in you markup
grep is your friend.
some errors. should be
and
grep is your friend.
Works! Thanks to your lead and studying some Javascript (never used it) I have been able to fix it as follows. Note that it's not very clean but it works... =P Went with a part retrieval because the VIEW returned a complete form that did not fit the design of the website.
Header:
Form:
Related JS.
Some options
You can create a module in Vanilla with a login form to suit your site, and load it directly, you can even use the same module on the vanilla pages. Obviously you would make use of the form builder, rather then hard coding.
You don't have to use
jQuery.load
you can usejQuery.get
orjQuery.ajax
, there is no need to insert the div in the DOM to manipulate it with jQuery, it can simply be a standalone elementfrm_obj = $('<div>').htm(data)
grep is your friend.
That is an interesting feature of
load
the#target
. Actually your solution is not too bad for inserting theTransientKey
. I would go for the Vanilla module option for uniformity, but still ok.grep is your friend.