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

custom dialog web data not populating db

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

    custom dialog web data not populating db

    Hi all,

    I need some help.

    I've created a database.

    Then created a custom dialog component added it to a a5w page which when run gives a web page where the user can enter info into the fields and press the submit button. which should then create a new record in the database.

    The problem is when you press the submit button nothing happens.

    Besides creating the custom dialog component do I have to write an xbasic script which will enter the info into the database?

    Many Thanks

    Tim

    #2
    Tim,

    Yes you do. Below is a script I use for one of my entry dialog components. This goes in the AfterValidate event.

    Code:
     
    Dim tbl as P
    tbl=table.open("[PathAlias.ADB_path]\lists")
    tbl.enter_begin()
    tbl.Li_name=vLi_Name
    tbl.Li_entid=session.__protected__En_Id
    tbl.Li_entname=session.En_Name
    tbl.Li_detail=vLi_detail
    tbl.Li_type=vLi_type
    tbl.Li_status=vLi_status
    tbl.Li_date=convert_type(vLi_date,"D")
    tbl.Li_comment=vLi_comment
    tbl.enter_end(.t.)
    session.Li_Id=tbl.Li_id
    session.Li_Name=tbl.Li_name
    tbl.close()
    Currentform.RedirectTarget = "Li_Contents.a5w"
    The variables starting with "v" are the variable names used for the fields in the dialog. Also notice that the varables in the dialog are all character, so you need to convert to different types (see the date variable above.)

    Pat
    Pat Bremkamp
    MindKicks Consulting

    Comment


      #3
      Hi Pat,

      Many thanks for replying so fast!

      I'll give it a try and let you know how I get on.

      Many Thanks

      Tim

      Comment


        #4
        Adapted script which dosn't work

        Hi Pat,

        I've adapted your script and tried but I now get an error 'Variable "vCr_no" not found'. This is my script;

        -------------------------------------------

        Dim tbl as P
        tbl=table.open("chg_cust_data_sla")
        tbl.enter_begin()
        tbl.Cr_no=vCr_no
        tbl.Assyst_no=vAssyst_no
        tbl.Index_no=vIndex_no
        tbl.Taf_no=vTaf_no
        tbl.Diagram_ref=vDiagram_ref
        tbl.Raised_by=vRaised_by
        tbl.Sla_type=vSla_type
        tbl.Date_raised=convert_type(vDate_raised,"D")
        tbl.Meth_soft_down=vMeth_soft_down
        tbl.Targ_comp_date=vTable_comp_date
        tbl.Contract_chgs=vContract_chgs
        tbl.Source_of_req=vSource_of_req
        tbl.Status=vStatus
        tbl.Descr_1=vDescr_1
        tbl.Just_rea_chng=vJust_rea_chng
        tbl.Ch_act_cm_co=vCh_act_cm_co
        tbl.Co_sig_file=vCo_sig_file
        tbl.Cr_close_cm=vCr_close_cm
        tbl.Cm_sig_file=vCm_sig_file
        tbl.Company_name=vCompany_name
        tbl.Cust_phone=vCust_phone
        tbl.Cust_phone_two=vCust_phone_two
        tbl.Bill_address_1=vBilling_address_1
        tbl.Bill_address_2=vBilling_address_2
        tbl.Bill_city=vBill_city
        tbl.Bill_county=vBill_county
        tbl.Bill_postal_code=vBill_postal.code
        tbl.Bill_Country=vBill_country
        tbl.Bill_phone=vBill_phone
        tbl.Bill_phone_two=vBill_phone_two
        tbl.Bill_email=vBill_email
        tbl.Company_name=vCompany_name
        tbl.Close_date=convert_type(vClose_date,"D")
        tbl.Cust_contact=vCust_contact
        tbl.Customer_email=vCustomer_email
        tbl.Site_address_1=vSite_address_1
        tbl.Site_address_2=vSite_address_2
        tbl.Site_city=vSite_city
        tbl.Site_county=vSite_county
        tbl.Site_postal_code=vSite_postal
        tbl.Site_country=vSite_country
        tbl.Site_phone=vSite_phone
        tbl.Site_phone_two=vSite_phone_two
        tbl.enter_end(.t.)
        tbl.close()
        Currentform.RedirectTarget = "Change Customer Data Sla.a5w"


        ----------------------------------------------

        I hope you can help?

        Many Thanks

        Tim

        .............................................................

        Originally posted by Pat Bremkamp
        Tim,

        Yes you do. Below is a script I use for one of my entry dialog components. This goes in the AfterValidate event.

        Code:
         
        Dim tbl as P
        tbl=table.open("[PathAlias.ADB_path]\lists")
        tbl.enter_begin()
        tbl.Li_name=vLi_Name
        tbl.Li_entid=session.__protected__En_Id
        tbl.Li_entname=session.En_Name
        tbl.Li_detail=vLi_detail
        tbl.Li_type=vLi_type
        tbl.Li_status=vLi_status
        tbl.Li_date=convert_type(vLi_date,"D")
        tbl.Li_comment=vLi_comment
        tbl.enter_end(.t.)
        session.Li_Id=tbl.Li_id
        session.Li_Name=tbl.Li_name
        tbl.close()
        Currentform.RedirectTarget = "Li_Contents.a5w"
        The variables starting with "v" are the variable names used for the fields in the dialog. Also notice that the varables in the dialog are all character, so you need to convert to different types (see the date variable above.)

        Pat

        Comment


          #5
          Tim,

          Did you define your fields in the dialog with the vWhatever names? See the picture attached. The "v" is just a convention I use and not really necessary.

          Also, you should get in the habit of using the [PathAlias.ADB_Path] in all your table references so your application can be moved to another server. That will save you having to redo these later.

          Pat
          Pat Bremkamp
          MindKicks Consulting

          Comment


            #6
            Hi Pat,

            I have just started using you code (above). I can see that you have converted the date field. How would i modify the code to convert fields to

            a. Numerical
            b. Logical (i.e. YES/NO)

            Thanks in advance.

            Denis

            Comment


              #7
              Denis,

              On a different note, you know if you create a Grid rather than a Dialog, that the grid will take care of adding records to the datbase without writing any xbasic. You may have a special need for the dialog. But look at the Grid Property called Add Record Only and see if it applies to your situation.
              Steve Wood
              See my profile on IADN

              Comment


                #8
                Thanks for that Steve. I need to use the dialog as i have cascading dropdowns and as its only going to be available in v8, i have gone the dialog route. I have managed to get the answer for a bit of searching around. For the benefit of other the code is as follows;

                Code:
                tbl.Value=convert_type(vValue,"N")
                This will allow the dialog to recognise the field as a Numerical value.

                Thanks again.

                Comment


                  #9
                  populating two tables with one dialog

                  Hi Again.

                  Many thanks for all previous help.

                  I've got two tables and one dialog. In the aftervalidate I've used this code

                  Dim tbl as P
                  tbl=table.open("chg_cust_data_sla")
                  tbl.enter_begin()
                  tbl.Cr_no=vCr_no
                  tbl.Assyst_no=vAssyst_no
                  tbl.Index_no=vIndex_no
                  tbl.Taf_no=vTaf_no
                  tbl.Diagram_ref=vDiagram_ref
                  tbl.Diagram_ref1=vDiagram_ref1
                  tbl.Raised_by=vRaised_by
                  tbl.Sla_type=vSla_type
                  tbl.Date_raised=convert_type(vDate_raised,"D")
                  tbl.Meth_soft_down=vMeth_soft_down
                  tbl.Targ_comp_date=convert_type(vTarg_comp_date,"D")
                  tbl.Contract_chgs=vContract_chgs
                  tbl.Source_of_req=vSource_of_req
                  tbl.Descr_1=vDescr_1
                  tbl.Just_rea_chng=vJust_rea_chng
                  tbl.Customer_id=vCustomer_id
                  tbl.enter_end(.t.)
                  tbl.close()
                  tbl=table.open("customer_information")
                  tbl.enter_begin()
                  tbl.Cust_Contact=vCust_Contact
                  tbl.Company_Name=vCompany_Name
                  tbl.Bill_Address_1=vBill_Address_1
                  tbl.Bill_Address_2=vBill_Address_2
                  tbl.Bill_City=vBill_City
                  tbl.Bill_County=vBill_County
                  tbl.Bill_Postal_Code=vBill_Postal_Code
                  tbl.Bill_Country=vBill_Country
                  tbl.Site_Address_1=vSite_Address_1
                  tbl.Site_Address_2=vSite_Address_2
                  tbl.Site_City=vSite_City
                  tbl.Site_County=vSite_County
                  tbl.Site_Postal_Code=vSite_Postal_Code
                  tbl.Site_Country=vSite_Country
                  tbl.Site_Phone=vSite_Phone
                  tbl.Site_Phone_Two=vSite_Phone_Two
                  tbl.Bill_Phone=vBill_Phone
                  tbl.Bill_Phone_Two=vBill_Phone_Two
                  tbl.Customer_Email=vCustomer_Email
                  tbl.Bill_Email=vBill_Email
                  tbl.Customer_Id=vCustomerin_Id
                  tbl.enter_end(.t.)
                  tbl.close()
                  Currentform.RedirectTarget = "cstcrinp.a5w"

                  The 'chg_cust_data_sla' table populates ok but the second 'customer_information' table doesn't.

                  All the fields are configured ok.

                  Many Thanks

                  tim

                  Please can some explain where I'm going wrong in the script.

                  Comment


                    #10
                    Your forgot your path alias:

                    Code:
                    t = table.open("[PathAlias.ADB_path]\customer_information")
                    You might also want to use different pointers within the same script, or delete & re-dim the tbl pointer. It's probably OK, but could lead to some confusion.
                    -Steve
                    sigpic

                    Comment


                      #11
                      Re: custom dialog web data not populating db

                      Hi Steve,

                      That worked a treat. I've modified the script to the following,

                      im tbl as P
                      tbl=table.open("[PathAlias.ADB_path]\chg_cust_data_sla")
                      tbl.enter_begin()
                      tbl.Cr_no=vCr_no
                      tbl.Assyst_no=vAssyst_no
                      tbl.Index_no=vIndex_no
                      tbl.Taf_no=vTaf_no
                      tbl.Diagram_ref=vDiagram_ref
                      tbl.Diagram_ref1=vDiagram_ref1
                      tbl.Raised_by=vRaised_by
                      tbl.Sla_type=vSla_type
                      tbl.Date_raised=convert_type(vDate_raised,"D")
                      tbl.Meth_soft_down=vMeth_soft_down
                      tbl.Targ_comp_date=convert_type(vTarg_comp_date,"D")
                      tbl.Contract_chgs=vContract_chgs
                      tbl.Source_of_req=vSource_of_req
                      tbl.Descr_1=vDescr_1
                      tbl.Just_rea_chng=vJust_rea_chng
                      tbl.Customer_id=vCustomer_id
                      tbl.enter_end(.t.)
                      tbl.close()
                      Dim tbl1 as P
                      tbl1=table.open("[PathAlias.ADB_path]\customer_information")
                      tbl1.enter_begin()
                      tbl1.Cust_Contact=vCust_Contact
                      tbl1.Company_Name=vCompany_Name
                      tbl1.Bill_Address_1=vBill_Address_1
                      tbl1.Bill_Address_2=vBill_Address_2
                      tbl1.Bill_City=vBill_City
                      tbl1.Bill_County=vBill_County
                      tbl1.Bill_Postal_Code=vBill_Postal_Code
                      tbl1.Bill_Country=vBill_Country
                      tbl1.Site_Address_1=vSite_Address_1
                      tbl1.Site_Address_2=vSite_Address_2
                      tbl1.Site_City=vSite_City
                      tbl1.Site_County=vSite_County
                      tbl1.Site_Postal_Code=vSite_Postal_Code
                      tbl1.Site_Country=vSite_Country
                      tbl1.Site_Phone=vSite_Phone
                      tbl1.Site_Phone_Two=vSite_Phone_Two
                      tbl1.Bill_Phone=vBill_Phone
                      tbl1.Bill_Phone_Two=vBill_Phone_Two
                      tbl1.Customer_Email=vCustomer_Email
                      tbl1.Bill_Email=vBill_Email
                      tbl1.Customerin_Id=vCustomerin_Id
                      tbl1.enter_end(.t.)
                      tbl1.close()
                      Currentform.RedirectTarget = "cstcrinp.a5w"

                      Another question for you if I may.

                      I want to be able to format the validating errors messages. For instance I forget to fill in a field and the border turns red and an error message appears at the top of the screen i.e.

                      vTaf_no: Field must be at least 3 characters.
                      Field cannot be empty.

                      1, Is this formatible through validation rules?
                      2, If I wan't to output the error message say above the input box that's been filled in inocorrectly i.e. above the red input box, how can I achieve that?

                      Many Thanks

                      Tim

                      Comment

                      Working...
                      X