• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Update hidden edit fields with a different value

Explorer ,
May 05, 2013 May 05, 2013

Copy link to clipboard

Copied

Hi,

I am using a couple of web app fields to style other web app edit fields hidden or revealed.

eg class="{tag_hideReveal 1}" will output class="hide" or class="reveal".

When the web app is created the hideReveal values were set. I am trying to update the values in hidden fields using the edit page.

However they always return the current value of the field, even if I physically write the opposite into the edit page code. I don't want this value to be set be customers, it must be hidden.

How can I make these swap? Will jquery or javascript do it? Basically if one is reveal, I will want it to be hide, and vice versa.

Edit page code

______________________________________________________________________________________________________________

<div class="{tag_hideReveal 1}">

             <label>Do you, the host, agree to the Term and Conditions and wish to make an offer to the visitor?</label>

                <input type="checkbox" name="CAT_Custom_255715" id="CAT_Custom_255715_0" value="Yes" />Yes</div>

<input type="hidden" name="CAT_Custom_257330" id="CAT_Custom_257330" class="hideReveal" value="hide" /><!-- was reveal, now I want it be hide -->

              

<div class="{tag_hideReveal 2}"><label>Do you, the visitor, agree to the Terms and Conditions and accept the offer from the host?</label>

                <input type="checkbox" name="CAT_Custom_255716" id="CAT_Custom_255716_0" value="Yes" />Yes</div>

<input type="hidden" name="CAT_Custom_257331" id="CAT_Custom_257331" class="hideReveal" value="reveal" /><!-- was hide, now I want it be reveal -->

______________________________________________________________________________________________________________

Outputted code


<div class="reveal">

             <label>Do you, the host, agree to the Term and Conditions and wish to make an offer to the visitor?</label>

                <input type="checkbox" name="CAT_Custom_255715" id="CAT_Custom_255715_0" value="Yes" />Yes</div>

<input type="hidden" name="CAT_Custom_257330" id="CAT_Custom_257330" class="hideReveal" value="reveal" /><!-- was reveal, now I want it be hide -->

              

<div class="hide"><label>Do you, the visitor, agree to the Terms and Conditions and accept the offer from the host?</label>

                <input type="checkbox" name="CAT_Custom_255716" id="CAT_Custom_255716_0" value="Yes" />Yes</div>

<input type="hidden" name="CAT_Custom_257331" id="CAT_Custom_257331" class="hideReveal" value="hide" /><!-- was hide, now I want it be reveal -->

Thanks!!

TOPICS
Web apps

Views

734

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
May 06, 2013 May 06, 2013

Copy link to clipboard

Copied

I'm just a little confused.  You are using these tags on the EDIT item layout for the web app? But you also want to reveal/hide some content based on their selection while on the edit layout view?

Why are you using two {tag_hideReveal} tags (ie- {tag_hideReveal 1} and {tag_hideReveal 2}?  If you intend for it to be one or the other, you should use one tag {tag_hideReveal} and the value will be either "hide" or reveal". So then your code could be:

<div class="{tag_hideReveal}">

             <label>Do you, the host, agree to the Term and Conditions and wish to make an offer to the visitor?</label>

                <input type="checkbox" name="CAT_Custom_255715" id="CAT_Custom_255715_0" value="Yes" />Yes</div>

<input type="hidden" name="CAT_Custom_257330" id="CAT_Custom_257330" class="hideReveal" value="{tag_hideReveal}" /><!-- was reveal, now I want it be hide -->

</div>

And use CSS to hide .hide and you can do nothing with the .reveal class:

.hide { display: none; }

This way that DIV will be shown when hideReveal is set to reveal and be hidden when it's set to hide. 

I might be missing something from your explanation. Let me know if I am getting the gist.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 06, 2013 May 06, 2013

Copy link to clipboard

Copied

Hi,

I know, it is a bit confusing. The reason being is that we have 2 customers using the smae edit form. Therefore, when one customer has editied it, I want the fields to update and be ready for th secod customer to use.

Correct, .hide is display: none, and .reveal has no CSS and so is shown.

The essential info is how to change the existing value of {tag_hideReveal} to the other value, in a hidden input. When the page loads, the value of the input is updated to the current value, regardless of what values I enter in the Edit code.

I think it must be javascript.

Anyway, thanks for looking!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 06, 2013 May 06, 2013

Copy link to clipboard

Copied

LATEST

I added this to the head - it seems to work.

Thank you!!

     <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>

        <script type="text/javascript">

$(document).ready(function()

                  {

                    $("#CAT_Custom_257330").val("hide");

                    $("#CAT_Custom_257331").val("reveal");

             

                  });

</script>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines