Members Login.
 

Please register HERE to be part of our Community
Contest of the Day.
 
Current Promotions.
 
Earn By Posting
 
Participate in forum and Earn $$$.
  • Referrer Credit - BRL$ 100
  • Positive Rep Cr. - BRL$ 3
  • New Thread Cr.- BRL$ 3
  • Posting Cr. - BRL$ 2
  • Post size Credit
Full List of BRL$ Earnings
Sponsors.
 


JavaScript JavaScript is widely used to display client side browser actions. You can discuss anything related to Javascript tutorials, tricks and tips here..

Expired Thread The thread "Validation and distinguishing between remote and local images" has not received any replies for a month. It has been automatically closed as a result. You may start a new thread on the topic if the information in this thread is not sufficient.

Closed Thread
  #1 (permalink)  
Old 07-09-2007
Senior Member
 
Join Date: Jun 2007
Posts: 1,413
BRL$: 4,331.66
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 169
mr_atom is on a distinguished roadmr_atom is on a distinguished road
Default Validation and distinguishing between remote and local images

Okay, I have two issues that are kind of one in the same. First off, I am trying to validate some forms I have. The form of validation I am using is from this link: http://www.javascript-coder.com/html...lidation.phtml In my form, I have a few fields which are not required, but if a certain field has a value then another field would be required. For example, if the user input a number for 'mileage' then they should also be required to provide 'mileage_units'. I tried several techniques to get this to work, but none of them work. 'undefined' was my last attempt. I have tried != '' as well, but that also did not work. Secondly, I allow users to provide an image with this form. They can choose to upload an image from their local machine, or they can provide a remote URL of an image. What I want to do is integrate my validation to ensure they are not providing both of the image types. I tried to do some of the custom validation the script uses, but to no avail. I am pretty new to js although I do kind of understand it, just new to the object oriented aspect. Along with this, I am unsure of how to code the checks to see which image was provided. Any PHP suggestions for that would also be warranted. Below is my generated source of the form as well as the js validation following....any help would be greatly appreciated! Code: --------- Year [Required] Select Year 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 Make [Required] Select Make ------ACAcuraAixamAlfa-RomeoAsiaAston-MartinAudiAustinBentleyBMWBristolCadillacCaterhamC hevroletChryslerCitroenDaewooDaihatsuDaimlerDatsun DelorianDodgeFerrariFiatFordFSOGinettaGriffonHillm anHMCHondaHummerHyundaiISOIsuzuJaguarJeepJensenKia LadaLamborghiniLanciaLand RoverLexusLigierLincolnLotusMarcosMaseratiMaybachM azdaMcLarenMercedes-BenzMGMicrocarMiniMitsubishiMorganMorrisNissanNobl eOpelPaganiPantherPeroduaPeugeotPontiacPorscheProt onReliantRenaultRileyRolls RoyceRoverSaabSaoSeatSingerSkodaSmartSsangYongSuba ruSunbeamSuzukiTalbotTataToyotaTriumphTVRUltimaVau xhallVolkswagenVolvoWestfieldYugo Not Listed? Click Here Model [Required] dol.printOptions("model_id") Not Listed? Click Here Engine Type Select Engine Type ------8 Cylinder Naturally8 Cylinder Forced Induction6 Cylinder Naturally6 Cylinder Forced Induction4 Cylinder Naturally4 Cylinder Forced Induction Color Mileage Select Mileage Type ------ Miles Kilometers Purchased Price Currency: Select Currency ------GBPUSDEURCADYEN Description Image Attachments You may attach an image.
Maximum file size : 1024 kbytes
Maximum resolution : 1024
Enter a URL to an online image Description var frmvalidator = new Validator("add_vehicle"); var frm = document.forms["add_vehicle"]; frmvalidator.addValidation("made_year","req","Plea se select a year."); frmvalidator.addValidation("made_year","dontselect =0","Please select a year."); frmvalidator.addValidation("make_id","req","Please select a make."); frmvalidator.addValidation("make_id","dontselect=0 ","Please select a make."); frmvalidator.addValidation("make_id","dontselect=1 ","Please select a make."); frmvalidator.addValidation("model_id","req","Pleas e select a model."); frmvalidator.addValidation("color","regexp=^[A-Za-z]{1,20}$","Color must consist of letters only and have a maximum of 20 characters."); frmvalidator.addValidation("mileage","numeric","Mi leage must be a numeric value."); if(frm.mileage.value != undefined) { frmvalidator.addValidation("mileage_units","req"," Please select a mileage unit."); frmvalidator.addValidation("mileage_units","dontse lect=0","Please select a mileage unit."); } frmvalidator.addValidation("price","numeric","Pric e must be a numeric value."); if(frm.price.value != undefined) { frmvalidator.addValidation("currency","req","Pleas e select a currency."); frmvalidator.addValidation("currency","dontselect= 0","Please select a currency."); } frmvalidator.addValidation("comments","maxlen=500" ,"Description must be less than 500 characters."); ---------

More...
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


Current Promotions... Post a New Thread anywhere on Web Development Board to earn BRL$ 5 for every thread. Post a new Reply there and earn BRL$ 3 for every reply.
Important - Read before posting Please carefully read the Global Rules and Posting Rules for GPT / Buy - Sell Offers / Link Exchange sections before posting.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Closed Thread
Expired Thread The thread "Validation and distinguishing between remote and local images" has not received any replies for a month. It has been automatically closed as a result. You may start a new thread on the topic if the information in this thread is not sufficient.



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103