function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
frederic baudaxfrederic baudax 

onclick - if condition mixed with ok/cancel popup

wonder if anyone has already done this and/or if it's possible.

 

I'm trying to embed a button that check if condition X is met into a VF page trough the onclick tag

 

if not met => process

if met display a popup with "ok/cancel" 

  => if cancel, return to record

  => if ok, process

 

Tried about all options/formats I could think off but to no avail

 

to give the basics, if the stock X is 0 when you try to place an order > display msg to inform it will take time, if the user cancel,no action taken or on OK go on with the order. if the stock is > 0 go on without popup

 

shoul be something along the line of onclick="{!if(Visibility_Item_Stock__c.available_quantity_F__c == 0 ,'true','false'); return confirm('Be aware there might be a delay since there is no stock right now, Dealer support will inform you when and if the stock will be replenished.')}"

 

Thanks to anyone that would help on this 

 

sforce2009sforce2009

use a page with standard controller as your custom object.

then on js,

<script>

    if('{!objectname.fieldname}' == 'true') 

    {

        if( confirm('xxxxxxxxx'))

        {

             //process

        }

         else

         {

             window.location.href = '../'     + '{!objectname.Id}'

         }
 

    } 

    else

    {

       window.location.href = '../'     + '{!objectname.Id}'

    } 

 

 </script>

hope this helps 

frederic baudaxfrederic baudax

Will try out of personal knowledge seeking. Ended up with a conditional rendered pageblock which the management liked more than the idea of the popup so i'll stick with that.

 

Thanks anyway