nuPrompt() Insert into Field?

Questions related to customising nuBuilder Forte with JavaScript or PHP.

Re: nuPrompt() Insert into Field?

Unread postby pmjd » Wed Sep 15, 2021 6:31 pm

Fantastic! Working now as hoped.

The only other question i have, is there a way to make sure tex is written in the nuPrompt box, so it can't be left blank?

No worries if not.
pmjd
 
Posts: 76
Joined: Fri Mar 12, 2021 7:08 pm
nuBuilder Version: 4.5

Re: nuPrompt() Insert into Field?

Unread postby kev1n » Wed Sep 15, 2021 6:46 pm

Check if the value is blank and show nuPrompt again.

Code: Select all
function nuOnPromptClose(val, ok) { 
   if (ok) {
        if (val.trim() == '') {
           nuMessage('***someting*** cannot be left blank')
           setTimeout(function(){ nuPrompt('someting', 'caption'); }, 200);
        }
        nuSetValue('mpd_reason', val);
        nuDisable('mpd_status')
    } else {
        nuSetValue('mpd_status', status);
    }
}



nuPrompt('someting', 'caption');
kev1n
nuBuilder Team
 
Posts: 2008
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Previous

Return to Custom Code

Who is online

Users browsing this forum: No registered users and 3 guests