Skip navigation
Cat13blue
Currently Being Moderated

Java script help for popup dialog boxes

Aug 13, 2012 8:25 AM

Hi, I have been trying to create a popup dialog box to tell users to fill in certain form fields. I don't know Java so I have been using a script that I found in the forums, but I need to be able to modify the text. Can anyone tell me how to do this? Here is the script. Thanks.

 

var requiredFields = [], error = "";

for (var i = 0; i < numFields; i++) {

    var fName = getNthFieldName(i);

    var f = getField(fName);

    if (f.type !== "button" && f.required && !f.valueAsString) {

        requiredFields.push(fName);

        error += fName + "\r";

    }

}

if (error) {

    app.alert("Please complete the following fields: \r\r" + error, 3);

    getField(requiredFields[0]);

} else {

}

 
Replies
  • George Johnson
    9,208 posts
    Aug 11, 2002
    Currently Being Moderated
    Aug 13, 2012 10:58 AM   in reply to Cat13blue

    What text do you want to modify, exactly?

     
    |
    Mark as:
  • George Johnson
    9,208 posts
    Aug 11, 2002
    Currently Being Moderated
    Aug 14, 2012 7:24 AM   in reply to Cat13blue

    The script currently gets that text from the field names. What you want would make for rather long field names, but the script could be changed to use the field's tooltip text instead, or you could do something like set up an array to associate field descriptions with field names. So what will work with the current script is to simply change the field names to suit your needs, but I would personally use one of the other approaches. Post again if you need more help.

     
    |
    Mark as:
  • George Johnson
    9,208 posts
    Aug 11, 2002
    Currently Being Moderated
    Aug 14, 2012 2:04 PM   in reply to Cat13blue

    The current script is really just for text fields, so it would have to be modified to work with check boxes, radio buttons, list boxes and dropdowns. With radio buttons, either none can be selected by default or one could be, indicating that a valid option has not been selected. I would have to know how you have the radio button group set up to suggest some code you could use.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points