Announcement

Collapse
No announcement yet.

confirmation message olny if field value is x

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

  • confirmation message olny if field value is x

    hello

    if you want to display simply confirmation message to user when clicks the add/update button, we simply go to messages and select a message to show the user to confirm the submission, shows like OK and Cancel, user can select, that is correct.

    but if I have a field that value is x i want to display that message, otherwise, I don't wanna show... maybe i'm not thinking straight and still confused

    - tried sc_confirm macro didn't work, out of the scope should be used with PHP programming thing as said in manual, which i couldn't understand what to do

    - sc_message obviously has very limited function in the manual donesn't even serve unless one or 2 buttons

    - sc_alert and the sc_error will not do as it doesn't have confirmation message to ask user if OK or not


    how do you manage this guys?

  • #2
    up

    guys this issue drives me crazy, is it really so hard to add js code to give a message only if one value matches the if statement! sc_confirm seems do the job but tried 1000 ways without results so far, don't know maybe i'm missing something

    Comment


    • #3
      @Mike


      I have the same problem... Netmake solution.... "create a blank aplicacion for a yes/no button".... I've tried using js straight into the on validate event but is not that easy.

      try it yourself... maybe you'll find a better solution man.

      Comment


      • #4
        Thanks pal for passing by and for confirming my point. I will keep trying different ways to solve this and if found something usefull will update this post. cheerz.

        Comment


        • #5
          Don't know if this helps but stumbled on using sc_confirm in a PHP button and it works how I want. Not sure if it will work the way you want in an "if" - but - if you use sc_confirm("are you sure you....") will display the dialog with an OK or Cancel (as we know).

          Choosing OK and subsequent lines are executed. Choosing Cancel just exits at that point, it's like it executed sc_exit() - so no code is executed after the sc_confirm.

          So - if you want to use it in an "if" then you need to code it knowing that any "Cancel" will kill execution at that point. That should be do-able - either via an "if", or maybe though a switch/case set up if a bit more complex?

          Code:
          switch($i) {
          	case 1:
          		sc_confirm("Empty the table?");           // if Cancel is chosen then whole routine ends at this point
          		sc_exec_sql("TRUNCATE sc_log");
          		sc_commit_trans();
          		break;
          	case 2:                                             
          		echo $i;
          		break;
          	default:
          		echo "No matches!";
          		break;	
          }
          
          // Any code here is not even looked at if Cancel was chosen above...

          Comment


          • #6
            thank you adz1 for looking at this dude, nice idea as well, worth to try.

            This way below was given to me by Sempai kafecadm, I actually dind't try it yet but I guess it will do that "other" to be required as well.

            Code:
            PHP:
            ---------
            
            if ({combobox} == <other value lets say... 5>)
            {
                 if ( {otherfield} == '' )
                 {
                       sc_error_message('YOU STUPID MORON WHY WOULD YOU SELECT OTHER IF YOU ARE NOT FILLING THE PROPER FIELD... STUPID USER ;D');
                 }
            }
            ---------
            I will try both ideas ASAP, just not having enough time these days

            cheers

            Comment

            Working...
            X