Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Validation Xbasic

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #31
    Re: Validation Xbasic

    So, we got it. The validation "CANNOT BE BLANK" just needs to go away once something is in the field.

    Comment


      #32
      Re: Validation Xbasic

      ok. Give this a try.
      Code:
      function setShip as c (e as p)
      	
      	
      dim validated[0] as p
      dim allValidated as c = ""
      dim js as c
      dim varJS[0] as p
      dim tracker as n = 0
      dim ShipFName as c = e.dataSubmitted.ShipFName
      dim ShipLName as c = e.dataSubmitted.ShipLName
      dim ShipAdd1 as c = e.dataSubmitted.ShipAdd1
      
      varJS[].original = <<%txt%
      $('<swap2>').innerHTML = "<swapit> &nbsp &nbsp &nbsp<font color=\"red\"> CANNOT BE BLANK</font>";
      %txt%
      varJS[].original = <<%txt%
      $('<swap2>').innerHTML = "<swapit>";
      %txt%
      
      
      
      validated[].swap = "First Name"
      validated[..].swap2 = "fn"
      validated[..].fieldVal = shipFname 'e.dataSubmitted.ShipFName
      
      validated[].swap = "Last Name"
      validated[..].swap2 = "ln"
      validated[..].fieldVal = shipLname 'e.dataSubmitted.ShipLName
      
      validated[].swap = "Shipping Address1"
      validated[..].swap2 = "a1"
      validated[..].fieldVal = ShipAdd1 'e.dataSubmitted.ShipAdd1
      
      js = ""
      debug(1)
      for each fld in validated
      	tempJS = varJS[1].original
      	tracker = tracker+1
      	if isnull(validated[tracker].fieldVal) then
      		allValidated = "false"
      		'''tempJS = "$('<swap2>').innerHTML = '<swapit> &nbsp &nbsp &nbsp<font color=\"red\"> CANNOT BE BLANK</font>';"
      		tempJS = strtran(tempJS,"<swapit>",validated[tracker].swap)
      		tempJS = strtran(tempJS,"<swap2>",validated[tracker].swap2)
      		js = js + tempJS
      	else
      		tempJS = varJS[2].original
      		tempJS = strtran(tempJS,"<swapit>",validated[tracker].swap)
      		tempJS = strtran(tempJS,"<swap2>",validated[tracker].swap2)			
      		js = js + tempJS
      	end if
      next
      
      if allValidated <> "false" then
      tracker = 0	
      for each fld in validated
      	tempJS = varJS[2].original
      	tracker = tracker+1
      	if .not. isnull(validated[tracker].fieldVal) then
      		allValidated = "false"
      		tempJS = "$('<swap2>').innerHTML = '<swapit>';"
      		tempJS = strtran(tempJS,"<swapit>",validated[tracker].swap)
      		tempJS = strtran(tempJS,"<swap2>",validated[tracker].swap2)
      		js = js + tempJS
      	
      	end if
      next
      end if
      	setShip = js
      
      end function
      Gregg
      https://paiza.io is a great site to test and share sql code

      Comment


        #33
        Re: Validation Xbasic

        Perfecto! Similar, although MUCH better than what I came up with from your last post. You got the adding the Field Name back in where I didn't have that part. Now I get to add all the other fields.

        I'm building a nice ecommerce web app. Then I get to do the mobile version. I'll be here for a while. :) Thanks so much for the help!

        Comment


          #34
          Re: Validation Xbasic

          FANTASTIC!!!!!!!
          Sorry it took so many tries to get it. It's what happens when computing time doesn't cost an arm and a leg.
          I don't know how many fields you're working with, but if it's more than just a few more, you might consider
          putting that information into a sql table, the building the validated array from a sql query.
          Benefits being cleaner code and easier to update if you need to add more columns in the future.
          Gregg
          https://paiza.io is a great site to test and share sql code

          Comment


            #35
            Re: Validation Xbasic

            There's not too many. Just the rest of the address fields.

            One housecleaning thing. I made a video instead of trying to explain it. :)
            https://www.screencast.com/t/i8wBEmT3u

            Comment


              #36
              Re: Validation Xbasic

              David,
              My boss gets irritated because I don't release code for general use until it passes my expectation of what it should do.
              Something based on two words that were never meant to be put together (good enough).
              Would you be kind enough to post your code?
              Gregg
              https://paiza.io is a great site to test and share sql code

              Comment


                #37
                Re: Validation Xbasic

                David,

                The line you added needs to append that code to the end of js.
                Code:
                js = js + "$('val').innerHTML = 'All done and continuing on....';"
                Gregg
                https://paiza.io is a great site to test and share sql code

                Comment


                  #38
                  Re: Validation Xbasic

                  Originally posted by madtowng View Post
                  David,
                  My boss gets irritated because I don't release code for general use until it passes my expectation of what it should do.
                  Something based on two words that were never meant to be put together (good enough).
                  Would you be kind enough to post your code?
                  Will do! Working on it now.

                  Comment


                    #39
                    Re: Validation Xbasic

                    Here's the final code along with a sample component with the fields and <div>'s.

                    The script tests each field for a Value. If the field isNull, "CANNOT BE BLANK" is set in the <div> that's in the Field Label. You could put the div anywhere you want, like after the field label. I wanted it right next to the label. Once all have values, the next part is ran which would typically include the script to process the form. You'll see a <div id='val'> which is the start of the second part.

                    The next step to this would be to create something where you could have customized messages for the fields and then maybe a couple different validation methods, like numeric only, or Zip Code, or masks for Phone Numbers, etc. I think this beats any stock ones because the stock ones don't work with your own xbasic form processing.

                    But, special thanks to Gregg for the majority of this. Great job!

                    And the rest of my processing is credit card stuff that's not complete yet, but this was the project of the day.

                    Code:
                    function setShip as c (e as p)
                    
                    dim validated[0] as p
                    dim allValidated as c = ""
                    dim js as c
                    dim varJS[0] as p
                    dim tracker as n = 0
                    
                    varJS[].original = <<%txt%
                    $('<swap2>').innerHTML = "<swapit> &nbsp &nbsp &nbsp<font color=\"red\" size=\"1\"> CANNOT BE BLANK</font>";
                    %txt%
                    varJS[].original = <<%txt%
                    $('<swap2>').innerHTML = "<swapit>";
                    %txt%
                    
                    validated[].swap = "First Name"
                    validated[..].swap2 = "fn"
                    validated[..].fieldVal = e.dataSubmitted.ShipFName
                    
                    validated[].swap = "Last Name"
                    validated[..].swap2 = "ln"
                    validated[..].fieldVal = e.dataSubmitted.ShipLName
                    
                    validated[].swap = "Address Line 1"
                    validated[..].swap2 = "a1"
                    validated[..].fieldVal = e.dataSubmitted.ShipAdd1
                    
                    'This is the Address Line 2 which normally is the Apartment number or Suite. Un-Comment out the 3 following lines to validate it.
                    'validated[].swap = "Address Line 2"
                    'validated[..].swap2 = "a2"
                    'validated[..].fieldVal = e.dataSubmitted.ShipAdd2
                    
                    validated[].swap = "City"
                    validated[..].swap2 = "ct"
                    validated[..].fieldVal = e.dataSubmitted.ShipCity
                    
                    validated[].swap = "State"
                    validated[..].swap2 = "st"
                    validated[..].fieldVal = e.dataSubmitted.ShipState
                    
                    validated[].swap = "Zip Code"
                    validated[..].swap2 = "zip"
                    validated[..].fieldVal = e.dataSubmitted.ShipZip
                    
                    validated[].swap = "Country"
                    validated[..].swap2 = "cy"
                    validated[..].fieldVal = e.dataSubmitted.ShipCountry
                    
                    validated[].swap = "Shipping Options"
                    validated[..].swap2 = "sm"
                    validated[..].fieldVal = e.dataSubmitted.ShipType
                    
                    js = ""
                    'debug(1)
                    for each fld in validated
                    	tempJS = varJS[1].original
                    	tracker = tracker+1
                    	if isnull(validated[tracker].fieldVal) then
                    		allValidated = "false"
                    		tempJS = strtran(tempJS,"<swapit>",validated[tracker].swap)
                    		tempJS = strtran(tempJS,"<swap2>",validated[tracker].swap2)
                    		js = js + tempJS
                    	else
                    		tempJS = varJS[2].original
                    		tempJS = strtran(tempJS,"<swapit>",validated[tracker].swap)
                    		tempJS = strtran(tempJS,"<swap2>",validated[tracker].swap2)			
                    		js = js + tempJS
                    	end if
                    next
                    
                    if allValidated <> "false" then
                    tracker = 0	
                    for each fld in validated
                    	tempJS = varJS[2].original
                    	tracker = tracker+1
                    	if .not. isnull(validated[tracker].fieldVal) then
                    		allValidated = "false"
                    		tempJS = "$('<swap2>').innerHTML = '<swapit>';"
                    		tempJS = strtran(tempJS,"<swapit>",validated[tracker].swap)
                    		tempJS = strtran(tempJS,"<swap2>",validated[tracker].swap2)
                    		js = js + tempJS
                    	
                    	end if
                    next
                    
                    js = js + "$('val').innerHTML = 'All done and continuing on....';"
                    
                    'This is where the next step goes. Typically would be the script to process the form results.	
                    	
                    end if
                    setShip = js
                    
                    end function
                    fieldValidation.zip

                    Comment


                      #40
                      Re: Validation Xbasic

                      cool. you got the message with the missing code.
                      I’m still at the office until this notebook is done with the network, but did that fix the problem?
                      Gregg
                      https://paiza.io is a great site to test and share sql code

                      Comment

                      Working...
                      X