Hi,
I have an enquiry page (uses enquiry relation) from which I go to a NEW bookings page (uses booking relation). Almost all the information from the enquiry page needs to be prepopulated into booking page if the record is new.
What are the ways to prepopulate data using frontend functions?
I'm new to Rei3, and I'm going through community forums. Could only find setting field values from one form field to another. I also went through a few frontend function in the sample apps. Is there another way to set values from one table to fields of current form?
Currently I added all the fields from the previous page as hidden values and added code like
if (app.get_record_id(0)===-1 && app.get_field_value({F23: 0 frn_bookings.enquiry_id})!==-1){
app.set_field_value({F4: 0 frn_bookings.primaryguestname},app.get_field_value({F26: 1 frn_enquiries.nameofenquirer}));
app.set_field_value({F7: 0 frn_bookings.address},app.get_field_value({F27: 1 frn_enquiries.address}));
app.set_field_value({F6: 0 frn_bookings.phone},app.get_field_value({F28: 1 frn_enquiries.phone}));
app.set_field_value({F5: 0 frn_bookings.email},app.get_field_value({F29: 1 frn_enquiries.email}));
}
Problem I'm facing
I have a datefrom and another dateto fileds which are clubbed together as period by rei3 framework.
below statement only sets value of bookingfrom. How do i set the value booking to?
if (app.get_record_id(0)===-1 && app.get_field_value({F23: 0 frn_bookings.enquiry_id})!==-1){
app.set_field_value({F11: 0 frn_bookings.bookingfrom},app.get_field_value({F30: 1 frn_enquiries.bookingfrom}));
}
not allowing me to set values in {F11: 0 frn_bookings.bookingto} as F11 represent "frn_bookings.bookingfrom"
Thanks in advance
Francis