NetTalk Central

Author Topic: Save Form after lookup browse automatically  (Read 4376 times)

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Save Form after lookup browse automatically
« on: October 02, 2008, 12:25:13 PM »
Hi

I am trying to address a minor issue that has been around for a while.  I have a form with two fields that uses an immediate browse lookup to fill the first field.  The lookup also sets the initial value of the second field.  The users may or may not (usually not) be allowed to change the second field value, so the second field is usually hidden.

Since the browse lookup effectively validates the user's choice already, I would like to save the form automatically on return from the lookup in those situations where the second field is hidden.

I thought a simple javascript based on the onClick value of the Save button might work:

onclick="document.AddBookingResource_frm.action='AddBooking'; document.AddBookingResource_frm.target='_self'; dsb(AddBookingResource_frm,save_btn,'save_btn','','');" 

and created this script:

<script type="text/javascript">
document.AddBookingResource_frm.action='AddBooking';
document.AddBookingResource_frm.target='_self';
dsb(AddBookingResource_frm,save_btn,'save_btn','','');
</script>

Although the script is being read by the browser nothing appears to happen.

Any help would be greatly appreciated.  Thank you

Apologies if this post is essentially the same as one posted yesterday.  I can't see that one in the forum and assume it was lost.

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Re: Save Form after lookup browse automatically
« Reply #1 on: October 03, 2008, 02:20:54 PM »
For the sake of anyone else facing the same problem, the solution is

<script type="text/javascript">
document.getElementById('save_btn').click()
</script>

Embarrassingly simple.   

mtabakin

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
    • Email
Re: Save Form after lookup browse automatically
« Reply #2 on: November 06, 2008, 10:53:45 AM »
I'm a real Newbie. I've been searching the forum for an answer and I think your javascipt might be it but, am unsure how to implement.

Here's my situation. Users can login in one of two ways. First is what I'd call the normal way. Going to the URL which brings up the LoginForm where they enter a Username and Password, then press "Save" (login). This works fine.

The second way is via a link in an e-mail I send out that contains a link to the URL PLUS two parameters, the Username and Password. The LoginForm extracts the Username and Pasword successfully and primes the correct fields but I have been unable to figure out how to "automatically" press the Save (login) button. The javascript you present may be the answer but I don't understand where to imbed it or how to use it.

Thanks in advance  for any help

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Save Form after lookup browse automatically
« Reply #3 on: November 07, 2008, 06:33:28 AM »
Hi Mike,

It would be implemented as xHtml on the xHtml tab, probably in one of the last places on the window (ie before </body> would be ideal.)

However: Have you considered how un-secure this approach is.

a) the mail travels in plain-text to the recipient (and hence the user's login and password can be seen.) Any packet sniffer on the LAN (at either end) can see the mail, and hence expose the login.

b) obviously the mail is stored on the user's machine, in the mail client, and thus anyone with direct, or remote, access to the machine can find the login & password.

A better approach is to get the user to enter the password themself (so it doesn't travel at all).

Cheers
Bruce

mtabakin

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
    • Email
Re: Save Form after lookup browse automatically
« Reply #4 on: November 08, 2008, 08:09:27 AM »
Bruce,

Thanks for the reply. The reason for putting the username & password in the link is one of customer convenience so they don't have to remember the information. What they will be logging into is not of a critical nature however I understand your concern.

What I didn't mention in my post was that I've used a method that you yourself (Capesoft) uses in Secwin registration and that is the "password" I send will actually expire after 24 to 48 hours (not sure which I'll use yet). After that time the user will have to manually login as would be the normal case. So thanks for the idea - I've been successfully using Capesoft products to enhance my products (and make my life easier!!!) for so long I can't rememver when I first purchased one of your products. Thanks again!

Mike