Need help with Javascript in AwareIM

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
mrduy
Posts: 13
Joined: Thu Feb 20, 2014 1:58 am

Need help with Javascript in AwareIM

Post by mrduy »

Hi,

I need to do a radio button has 2 choice: new customer and new member

If New customer is selected: the section to input information of new member will be hidden or not editable

If New member is selected: vice versa.

Can I do it with Javascript or AwareIM function ?
Thanks for your help
customaware
Posts: 2405
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Post by customaware »

You do not need Javascript to do that.


Assume....
BO name is MyBO
Attribute MyBO.RadioBut is your Radio Button

Attribute A,B and C should be visible for New Customer and D,E and F visible for New Member

In the Rules....something like

First Rule
RadioButton = 'Customer'

READ PROTECT MyBO.A FROM ALL EXCEPT System
READ PROTECT MyBO.B FROM ALL EXCEPT System
READ PROTECT MyBO.C FROM ALL EXCEPT System

Second Rule

RadioButton = 'Member'

READ PROTECT MyBO.D FROM ALL EXCEPT System
READ PROTECT MyBO.E FROM ALL EXCEPT System
READ PROTECT MyBO.F FROM ALL EXCEPT System

Make sure they are both Dynamic

You can also join it together in a single Rule but you will need to use textural rules for that
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
customaware
Posts: 2405
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Post by customaware »

Whoops!

MyBO.RadioButton ='Customer' and MyBO.RadioButton='Member' should be swapped around.

:-|
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
mrduy
Posts: 13
Joined: Thu Feb 20, 2014 1:58 am

Post by mrduy »

Hi eagles9999,

Thank you very much !

I have some problems:

- I need the radio-button is static choice.
- It works when the form is loaded, if radio button is New Customer then A B C will hidden. But when I change it to 'New Member', nothing happen.
- Can i make A B C enable when check Customer and A B C disable when check New Member ?
- I add new radio button name Level with 5 choices are 1,2,3,4,5 and Custom .
If Member is checked, the Level 4 will be checked, Custom enable and other are disable.
If Customer is checked, the Level 5 will be checked, Custom enable and other are disable.
If Custom is checked. all Level will enable and I can choose what I want.
customaware
Posts: 2405
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Post by customaware »

In the Presentation for the Radio Button....


Look down the bottom of the screen for the Other options.

Check the one that says..... Save Form when Selection Changes
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
customaware
Posts: 2405
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Post by customaware »

Here is a bsv to demonstrate.....

http://www.awareim.com/community/radio.bsv[/url]
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
mrduy
Posts: 13
Joined: Thu Feb 20, 2014 1:58 am

Post by mrduy »

eagles9999 wrote:Here is a bsv to demonstrate.....

http://www.awareim.com/community/radio.bsv[/url]
Thank you eagles9999.

I test your bsv demo and it work as it should but when i created my Business Object it did not work, when i check Save Form when Selection Changes, the form reload again with default choice in radio button. When i unchecked it, nothing happen. Wonder i miss something ?
customaware
Posts: 2405
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Post by customaware »

Off the top of my head I would think you have forgotten to select Dynamic in the Advance tab of the rules
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
mrduy
Posts: 13
Joined: Thu Feb 20, 2014 1:58 am

Post by mrduy »

eagles9999 wrote:Off the top of my head I would think you have forgotten to select Dynamic in the Advance tab of the rules
You're right, i misunderstood with Dynamic of radio button. Thank you again.

I it possible if i PROTECT a radio button and set selected for it ? Like the situation above.
mrduy
Posts: 13
Joined: Thu Feb 20, 2014 1:58 am

Post by mrduy »

I did it. It can not combine them in Textual Form. I must separate them into 2 rules
Post Reply