Help Desk Software & Beyond
May 17, 2012, 04:24:21 AM *
Welcome, Guest. Please login or register.
To post messages you need to register. We apologize for inconvenience, but this is to prevent spam.
Registration is instant (no email verification) and we do not ask for any personal information.

Login with username, password and session length
News: Welcome to Help Desk Software forum!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [REQ] Form Validation  (Read 1144 times)
peoriaparks
Newbie
*

Karma: 0
Posts: 8


View Profile
« on: October 07, 2010, 01:49:29 PM »

I am looking to create a new field called Price.  If someone enters a value more than 1500 in the price I need to stop the submission and display the red error of Please see your supervisor to get a written PO for this purchase.  Any help here is greatly appreciated!

« Last Edit: October 07, 2010, 01:52:05 PM by Sparky » Logged
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #1 on: October 07, 2010, 01:51:33 PM »

Please follow the posting guidelines in the READ ME sticky thread for the modification forum.

Although your request is more of a client-side programming issue.

You need to do this with Javascript form validation.  Once the form passes the validation routine, it gets submitted to ttx.
Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
peoriaparks
Newbie
*

Karma: 0
Posts: 8


View Profile
« Reply #2 on: October 07, 2010, 01:56:24 PM »

Ok, but when calling the custom fields it calls them in 1 block to the html page.  How can I single this field out?
Logged
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #3 on: October 07, 2010, 02:20:26 PM »

You'll have to replace the dynamically generated fields with static HTML so you can control them with Javascript.

This thread is close, not exact, but close to what you need to do for that first part...

http://forum.unitedwebcoders.com/index.php/topic,738.0.html
Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
peoriaparks
Newbie
*

Karma: 0
Posts: 8


View Profile
« Reply #4 on: October 08, 2010, 09:45:26 AM »

Ok, so I have a test form that works.  However, I think it isn't working on TTX b/c it doesn't know where to find the Javascript that is supposed to be in <head></head> tags.  Where do I put it???
Logged
peoriaparks
Newbie
*

Karma: 0
Posts: 8


View Profile
« Reply #5 on: October 08, 2010, 10:20:16 AM »

Aha!!  It wasn't the stuff in the head messing me up!!  It was on the submit button!  Changed it to this:

<form method=post action="(%ENV_SCRIPT_NAME%)" name=newticket enctype="multipart/form-data" onsubmit="return check(this)" onsubmit="return onlyone()">

Works like a charm.  I don't know if the double onsubmit is allowed or will work but I get no errors and my price field stops the ticket if the amount is not in range.  Many thanks Sparky!
Logged
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #6 on: October 08, 2010, 10:35:00 AM »

Aha!!  It wasn't the stuff in the head messing me up!!  It was on the submit button!  Changed it to this:

<form method=post action="(%ENV_SCRIPT_NAME%)" name=newticket enctype="multipart/form-data" onsubmit="return check(this)" onsubmit="return onlyone()">

Works like a charm.  I don't know if the double onsubmit is allowed or will work but I get no errors and my price field stops the ticket if the amount is not in range.  Many thanks Sparky!

I'm certain you can't have a two identical attributes within the same tag... it may work in a crappy non-compliant browser like Explorer but might not work in Firefox or Safari.

What's within "onsubmit" should follow the same rules as any Javascript...

Quote
onsubmit="return check(this);return onlyone();"

If you don't want to call two functions at once, you could combine check(); and onlyonce(); into one new Javscript just for this page.

See my Ticket Merge or Ticket Editor modifications for how to submit TTX via a Javascript.

« Last Edit: October 08, 2010, 10:39:25 AM by Sparky » Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
peoriaparks
Newbie
*

Karma: 0
Posts: 8


View Profile
« Reply #7 on: October 12, 2010, 08:14:13 PM »

Alright, got everything put together and it is working great!  I have attached a screen shot so you can see what I have done and I will explain it a bit.



The account number has to match a list that is specified on the server.  We contacted Alex earlier this year and he custom wrote that for us.  I have JavaScript that auto formats the account number to our standard format we use.  The estimated purchase price can not exceed a set dollar amount or it will give you an error that tells you to contact your Supervisor to get a PO of this amount, again JavaScript.  Other than that, I used a css template I found on the web for free and my Marketing department whipped up the logo.  If you have any questions about the functionality I would be happy to answer.  Thanks again Sparky!

PS - I also changed the ticket IDs so they are different than 1, 2, 3, etc, etc... they start with PO.. also all confirmations and emails have been modified to reflect a PO issue system instead of a help desk system.  I have also used this software in my other life (I used to be mhequipit when I was at MH Equipment).  I'm not sure if they still use that account to obtain help or not.  They are still using some of my other work at http://onservice.mhequipment.com/cgi-bin/ttx.cgi

W


« Last Edit: October 12, 2010, 08:42:47 PM by peoriaparks » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1 RC3 | SMF © 2001-2006, Lewis Media Valid XHTML 1.0! Valid CSS!
Page created in 0.026 seconds with 19 queries.