Field Required JS

598 views
Skip to first unread message

ale...@niceshirt.org

unread,
Aug 13, 2013, 5:00:57 PM8/13/13
to suppor...@runmyprocess.com
I used this JS script for show what required fields were missing when a button was selected:

function isWidgetValid(widget_id) {
var tmp_is_valid = true;
try {
tmp_is_valid = widget_id.isValid();
} catch (err) {}
return tmp_is_valid;
}

function getWidgetLabel(widget_id) {
var tmp_widget_label = "";
try {
tmp_widget_label = widget_id.getLabel();
} catch (err) {}
return tmp_widget_label;
}

function getWidgetType(widget_id) {
var tmp_widget_type = "";
try {
tmp_widget_type = widget_id.getType();
} catch (err) {}
return tmp_widget_type;
}

function displayMsgValidWidgets() {
//return an html message displaying fields not properly filled in
var a_all_widgets = RMPWidgets.getAllWidgets();
var html_msg_valid = "";
for (var i = 0; i < a_all_widgets.length; i++) {
if (getWidgetType(a_all_widgets[i]) != "RMP_Array") {
if (!isWidgetValid(a_all_widgets[i])) {
html_msg_valid = html_msg_valid + "<tr>" +
"<td><i>" + getWidgetLabel(a_all_widgets[i]) + "</i></td>" + "</tr>";
}
} else {
//is there any invalid field in the array?
for (var j in a_all_widgets[i]) {
var index_key = 0;
if ((j != "name") && (j != "type") && (j != "index")) {
var is_column_valid = true;
for (var k = 0; k < a_all_widgets[i][j].length; k++) {
is_column_valid = is_column_valid && isWidgetValid(a_all_widgets[i][j][k]);
if (!is_column_valid) {
html_msg_valid = html_msg_valid + "<tr>" +
"<td><i>" + a_all_widgets[i].getHeader(index_key) + "</i> (array column)</td>" + "</tr>";
}
}
}
index_key++;
}
}
}
if (html_msg_valid != "") {
html_msg_valid = "<div style='color:red;font-weight: bolder;'>The following fields are required:</div><table>" + html_msg_valid + "</table>";
}
//replace id_html_valid_widgets by your own html widget id
id_html_valid_widgets.setHtml(html_msg_valid);
}


Along with this html code to show the missing required fields: <!-- id_html_valid_widgets -->

However this does not happen for all of the fields of screens.

I have make available and active the js as well as the html but it still doesn't seem to be working after the first screen. Am I missing something?

Gareth Thiveux

unread,
Aug 14, 2013, 4:20:08 AM8/14/13
to suppor...@runmyprocess.com
Hi Alecia,

Have you set the ID of the HTML widget as id_html_valid_widgets ?
It's working on the first screen but not on the following ones ?
Be sure to make your JS and HTML availables (and also active for the JS and visible for the HTML) on each screen (availability, activity and visibility rules are managed by screen).

You also have to put the following code :
displayMsgValidWidgets();
true;

on every button that should display the message after clicking on it.


Regards,

Pre-Sales Consultant / Consultant Avant-Vente
 Fujitsu RunMyProcess
22 rue Chauchat, 75009 Paris - France (GMT+1)

     


Fujitsu RunMyProcess user? Please add a review on GoogleApps Marketplace

Afin de contribuer au respect de l'environnement, merci de n'imprimer ce message qu'en cas de nécessité.
Be environmentally friendly: do not print this email unless it is entirely necessary.



--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "RunMyProcess Support Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at http://groups.google.com/a/runmyprocess.com/group/supportforum/.
To view this discussion on the web visit https://groups.google.com/a/runmyprocess.com/d/msgid/supportforum/f7450d16-34a3-44e0-9250-d7be87a24459%40runmyprocess.com.
For more options, visit https://groups.google.com/a/runmyprocess.com/groups/opt_out.




Alecia Hitchman

unread,
Aug 21, 2013, 4:57:53 PM8/21/13
to suppor...@runmyprocess.com
Thank you it was : You also have to put the following code :
displayMsgValidWidgets();
true;

on every button that should display the message after clicking on it.

That I did not do.

Thanks for the help   




You received this message because you are subscribed to a topic in the Google Groups "RunMyProcess Support Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/a/runmyprocess.com/d/topic/supportforum/29VWPRT9Gvw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to supportforum...@runmyprocess.com.

To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at http://groups.google.com/a/runmyprocess.com/group/supportforum/.



--
In the Spirit of Nice, 

Alecia Hitchman

Know of anyone who would benefit from our services?  Refer them to us!
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages